Equal_rights_for_hash 0.0.4 + Ruby proposal

Hello,

Although Ruby has a rich set of primitive data types and structures,
the Hash seems neglected in the Ruby API in comparison to its peers:

| | Kernel | Implicit | Explicit | NilClass |

Class method conversion conversion conversion
String String() to_str to_s nil.to_s
Integer Integer() to_int to_i nil.to_i
Float Float() to_float to_f nil.to_f
Array Array() to_ary to_a nil.to_a
Hash MISSING to_hash MISSING MISSING

To rectify this un-orthogonality, I created a small Ruby library:

(gem) http://rubygems.org/gems/equal_rights_for_hash

(code) https://github.com/sunaku/equal_rights_for_hash

(docs) http://rubydoc.info/gems/equal_rights_for_hash

For more information, please see my proposal to incorporate the
above functionality into Ruby’s core API on the Ruby Issue Tracker:

http://redmine.ruby-lang.org/issues/5008

Thanks for your consideration.

On Tue, Oct 4, 2011 at 3:29 AM, Suraj N. Kurapati [email protected]
wrote:

| Float | Float() | to_float | to_f | nil.to_f |

For more information, please see my proposal to incorporate the
above functionality into Ruby’s core API on the Ruby Issue Tracker:

http://redmine.ruby-lang.org/issues/5008

Thanks for your consideration.

Despite the discussion in the bug I still do not understand why this
is useful. I notice that I have never missed this functionality. It
also seems that converting to a Hash is not as straightforward as
converting to an Array (because of the pairing of values). What would
be gained? Can you provide a number of use cases that demonstrate
overall usefulness?

Kind regards

robert

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs