Module: Mapable::ClassMethods
- Defined in:
- lib/mapable.rb
Overview
no-doc
Instance Method Summary collapse
Instance Method Details
#map_to(name, options = {}, &block) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/mapable.rb', line 21 def map_to(name, = {}, &block) mapping = Mapping.create(self, name, , &block) add_value_to_class_method(:maps, name => mapping) class_eval( <<-STR, __FILE__, __LINE__ + 1 def map_to_#{name}(dest) ::#{mapping.name}.new.map(self, dest) dest end STR ) end |
#maps ⇒ Object
17 18 19 |
# File 'lib/mapable.rb', line 17 def maps {}.freeze end |