Doug Jolley wrote:
> Is there something special about the session hash that would make it
> so that I can not access its associated fetch method? In attempting
> to do so I keep getting complaints that there is no such method.
> Thanks for any input.
>
> ... doug
It's not a hash; it only appears to be hash like? For instance,
class H
def initialize
@container = {}
end
def [](key)
@container[key]
end
def []=(key, val)
@container[key] = val
end
end
h = H.new
h["red"] = 10
puts h["red"]
puts h.fetch
--output:--
10
r1test.rb:19: undefined method `fetch' for #<H:0x24f2c
@container={"red"=>10}> (NoMethodError)
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: 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/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---