Class: AdvAccessor::BaseReaders
- Inherits:
-
Object
- Object
- AdvAccessor::BaseReaders
- Includes:
- FromHash
- Defined in:
- lib/adv_accessor/mapping.rb
Instance Attribute Summary collapse
-
#base ⇒ Object
Returns the value of attribute base.
Instance Method Summary collapse
Instance Attribute Details
#base ⇒ Object
Returns the value of attribute base.
23 24 25 |
# File 'lib/adv_accessor/mapping.rb', line 23 def base @base end |
Instance Method Details
#<<(x) ⇒ Object
25 26 27 |
# File 'lib/adv_accessor/mapping.rb', line 25 def <<(x) self.list << x end |
#get(ops) ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/adv_accessor/mapping.rb', line 28 def get(ops) ops[:val] ||= base.value list.each do |m| if m.match?(ops) os = OpenStruct.new(:value => ops[:val], :raw_value => base.raw_value) return m.block[os] end end raise "cant convert #{ops.inspect}" end |