Give me advices about method name

Hi,
I’m wondering what method names are appropriate for my library.
Could you give me advices?

Background:
I’m developping Motto-mysql library (not released yet).

This library will improve Mysql/Ruby driver.

Motto-mysql will add some methods to Mysql::Result class.

  • Mysql::Result#fetch_one_hash() returns a hash.
  • Mysql::Result#fetch_one_array() returns an array.
  • Mysql::Result#fetch_one_object(klass) returns an instance of klass
  • Mysql::Result#fetch_all_hash() returns an array of hashes
  • Mysql::Result#fetch_all_array() returns an array of arrays
  • Mysql::Result#fetch_all_object(klass) returns an array of instances

These methods convert data into proper type (Integer, Boolean, etc)

while Mysql::Result#fetch() returns all data as String.

For example, they return 3.14 while Mysql::Result#fetch() returns

“3.14”.

But I’m not sure these method names are appropriate and correct in
English.
Could you propose me if you have better names?

kwatch wrote:

Motto-mysql will add some methods to Mysql::Result class.

  • Mysql::Result#fetch_one_hash() returns a hash.
  • Mysql::Result#fetch_one_array() returns an array.
  • Mysql::Result#fetch_one_object(klass) returns an instance of klass
  • Mysql::Result#fetch_all_hash() returns an array of hashes
  • Mysql::Result#fetch_all_array() returns an array of arrays
  • Mysql::Result#fetch_all_object(klass) returns an array of instances

In English, the all* methods should pluralize their nouns…
fetch_all_hashes
fetch_all_arrays
fetch_all_objects
…or perhaps…
fetch_every_hash
fetch_every_array
fetch_every_object

I’m not sure I understand what these methods, do, though. If they
select only items of the described class, I would probably go with:
fetch_hashes
fetch_arrays
fetch_objects

However, if they take an existing results set and interpret the
entries as the described class, I would probably suggest instead:
fetch_as_hashes
fetch_as_arrays
fetch_as_objects

I hope that helps.

Thank you, Phrogz.
Your advice helps me very much.
I’ll adopt fetch_hashes() or fetch_as_hashes().


regards,
makoto kuwata