Module: EM::Sofa::Mapping::ClassMethods
- Defined in:
- lib/em-sofa/mapping.rb
Instance Method Summary collapse
-
#mappings ⇒ Hash<Symbol, Symbol>
Mapping of symbols to attribute names.
-
#mappings_procs ⇒ Hash<Symbol, Proc>
Mapping of attribute names to a Proc filter.
-
#maps(hash = {}, &block) ⇒ Object
Class method to define mappings.
Instance Method Details
#mappings ⇒ Hash<Symbol, Symbol>
Returns Mapping of symbols to attribute names.
96 97 98 |
# File 'lib/em-sofa/mapping.rb', line 96
def mappings
@mappings
end
|
#mappings_procs ⇒ Hash<Symbol, Proc>
Returns Mapping of attribute names to a Proc filter.
103 104 105 |
# File 'lib/em-sofa/mapping.rb', line 103
def mappings_procs
@mappings_procs
end
|
#maps(hash = {}, &block) ⇒ Object
Class method to define mappings.
85 86 87 88 89 90 91 92 |
# File 'lib/em-sofa/mapping.rb', line 85
def maps(hash = {}, &block)
hash.each do |from, to|
method = to || from
@mappings[from.to_sym] = method
attr_reader method
@mappings_procs[method] = block
end
end
|