Module: Sofa::Mapping::ClassMethods
- Defined in:
- lib/sofa/mapping.rb
Method Summary
- - (Hash<Symbol, Symbol>) mappings Mapping of symbols to attribute names.
- - (Hash<Symbol, Proc>) mappings_procs Mapping of attribute names to a Proc filter.
- - (Object) maps(hash = {}, &block) Class method to define mappings.
Method Details
- (Hash<Symbol, Symbol>) mappings
Mapping of symbols to attribute names
96 97 98 |
# File 'lib/sofa/mapping.rb', line 96
def mappings
@mappings
end
|
- (Hash<Symbol, Proc>) mappings_procs
Mapping of attribute names to a Proc filter.
103 104 105 |
# File 'lib/sofa/mapping.rb', line 103
def mappings_procs
@mappings_procs
end
|
- (Object) maps(hash = {}, &block)
Class method to define mappings.
85 86 87 88 89 90 91 92 |
# File 'lib/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
|