The idea to have one code for hash and for sequel model
Now we should write:
  unless m.is_a? Hash
    x = m
  else
    x = m.values
  end
With this alias we can just call

  x = m.to_hash


On Dec 4, 1:43 am, "Aman Gupta" <[EMAIL PROTECTED]> wrote:
> This is already possible with Sequel::Model#values
>
>   u = User[1]
>   u.values # => { :id => 1, :name => 'tmm1' }
>
>   Aman
>
> On Wed, Dec 3, 2008 at 3:24 PM, valodzka <[EMAIL PROTECTED]> wrote:
>
> > What do you think about adding method to_hash to Sequel#Model as alias
> > to method values. This can be useful, for example, when you want to
> > create copy or store to yam or do something other that can be done
> > with hash but can't be done with model and you don't known exactly
> > what kind of object you have.
> > # m - sequel::model or hash, we don't now exactly
> > m = m.to_hash
> > # now m is ruby hash
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to