Class: DRbQS::Setting::Source::DataContainer
- Inherits:
- BasicObject
- Defined in:
- lib/drbqs/setting/data_container.rb
Instance Attribute Summary collapse
-
#__array__ ⇒ Object
readonly
Returns the value of attribute array.
-
#__data__ ⇒ Object
readonly
Returns the value of attribute data.
-
#argument ⇒ Object
Returns the value of attribute argument.
Instance Method Summary collapse
- #__delete__(name) ⇒ Object
-
#initialize(array_class) ⇒ DataContainer
constructor
A new instance of DataContainer.
- #method_missing(name, *args) ⇒ Object
Constructor Details
#initialize(array_class) ⇒ DataContainer
Returns a new instance of DataContainer.
8 9 10 11 12 |
# File 'lib/drbqs/setting/data_container.rb', line 8 def initialize(array_class) @argument = [] @__data__ = {} @__array__ = array_class end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/drbqs/setting/data_container.rb', line 14 def method_missing(name, *args) if args.size > 0 s = name.to_s key = (/=$/ =~ s ? s[0...-1].intern : name.intern) @__data__[key] = (@__array__ === args[0] ? args[0] : args) else @__data__[name] end end |
Instance Attribute Details
#__array__ ⇒ Object (readonly)
Returns the value of attribute array.
6 7 8 |
# File 'lib/drbqs/setting/data_container.rb', line 6 def __array__ @__array__ end |
#__data__ ⇒ Object (readonly)
Returns the value of attribute data.
6 7 8 |
# File 'lib/drbqs/setting/data_container.rb', line 6 def __data__ @__data__ end |
#argument ⇒ Object
Returns the value of attribute argument.
5 6 7 |
# File 'lib/drbqs/setting/data_container.rb', line 5 def argument @argument end |
Instance Method Details
#__delete__(name) ⇒ Object
24 25 26 |
# File 'lib/drbqs/setting/data_container.rb', line 24 def __delete__(name) @__data__.delete(name.intern) end |