Class: RIO::State::Data
- Extended by:
- Fwd
- Defined in:
- lib/rio/state/data.rb
Instance Attribute Summary collapse
-
#store ⇒ Object
readonly
Returns the value of attribute store.
Instance Method Summary collapse
-
#initialize(h = {}) ⇒ Data
constructor
A new instance of Data.
- #initialize_copy(other) ⇒ Object
- #method_missing(sym, *args, &block) ⇒ Object
Methods included from Fwd
fwd, fwd_reader, fwd_readers, fwd_writer, fwd_writers
Constructor Details
#initialize(h = {}) ⇒ Data
Returns a new instance of Data.
30 31 32 33 34 35 |
# File 'lib/rio/state/data.rb', line 30 def initialize(h={}) @store = {} h.each do |k,v| @store[k] = v end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'lib/rio/state/data.rb', line 43 def method_missing(sym,*args,&block) if sym.to_s.end_with?('=') key = sym.to_s.chop.to_sym @store[key] = args[0] else @store[sym] end end |
Instance Attribute Details
#store ⇒ Object (readonly)
Returns the value of attribute store.
29 30 31 |
# File 'lib/rio/state/data.rb', line 29 def store @store end |
Instance Method Details
#initialize_copy(other) ⇒ Object
36 37 38 |
# File 'lib/rio/state/data.rb', line 36 def initialize_copy(other) @store = other.store.clone end |