Class: AdvAccessor::Readers

Inherits:
BaseReaders show all
Defined in:
lib/adv_accessor/mapping.rb

Instance Attribute Summary

Attributes inherited from BaseReaders

#base

Instance Method Summary collapse

Methods inherited from BaseReaders

#<<

Instance Method Details

#add(name, cls = nil, &b) ⇒ Object



59
60
61
62
# File 'lib/adv_accessor/mapping.rb', line 59

def add(name,cls=nil,&b)
  b = lambda { |x| base.mappings.get(cls) } if cls
  self << Reader.new(:name => name, :block => b)
end

#get(arg) ⇒ Object



63
64
65
66
# File 'lib/adv_accessor/mapping.rb', line 63

def get(arg)
  arg = {:name => arg} unless arg.kind_of?(Hash)
  super(arg)
end