On Monday, June 9, 2014, Sebastjan Hribar <sebastjan.hri...@gmail.com> wrote:
> Thank you for the detailed description! > > I have one question about the @state. Where does the method user_id come > from? I've been going through the unabridged source and Camping::Session > reference, but I guess I'm not proficient enough:) > > And what else can be also saved in the @state? > > regards > seba > @state (and @input) is an instance of Camping::H. Camping::H is a Hash with some sugar. You can use it like a regular Hash (it's actually a subclass of Hash): @state["user_id"] = 1 @state["user_id"] # => 1 But it also supports method-like access: @state.user_id = 1 @state.user_id # => 1 As long as it's not a method on Hash, you can use it as a getter/setter. You can save anything that can be serialized using Marshal: Marshal.dump(123) # => "\x04\bi\x01{" Marshal.load("\x04\bi\x01{") # => 123 -- // Magnus Holm
_______________________________________________ Camping-list mailing list Camping-list@rubyforge.org http://rubyforge.org/mailman/listinfo/camping-list