Class: AdvAccessor::DSL::Create
- Inherits:
-
Object
- Object
- AdvAccessor::DSL::Create
- Includes:
- FromHash
- Defined in:
- lib/adv_accessor/dsl.rb
Instance Attribute Summary collapse
-
#base ⇒ Object
Returns the value of attribute base.
-
#complex ⇒ Object
Returns the value of attribute complex.
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &b) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/adv_accessor/dsl.rb', line 9 def method_missing(sym,*args,&b) if base.respond_to?(sym) base.send(sym,*args,&b) else self.complex = true if !block_given? && args.first.kind_of?(Proc) b = args.pop end if args.first.kind_of?(Hash) h = args.pop mappings.add(h,&b) base.readers.add(sym,h.values.first) else base.readers.add(sym,*args,&b) end end end |
Instance Attribute Details
#base ⇒ Object
Returns the value of attribute base.
7 8 9 |
# File 'lib/adv_accessor/dsl.rb', line 7 def base @base end |
#complex ⇒ Object
Returns the value of attribute complex.
7 8 9 |
# File 'lib/adv_accessor/dsl.rb', line 7 def complex @complex end |