Module: Yaoc::MappingBase
- Defined in:
- lib/yaoc/mapping_base.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object (also: #to_hash_or_array)
- #converter_methods ⇒ Object
- #fetcher ⇒ Object
- #to_proc ⇒ Object
Class Method Details
.included(other) ⇒ Object
3 4 5 |
# File 'lib/yaoc/mapping_base.rb', line 3 def self.included(other) other.extend(ClassMethods) end |
Instance Method Details
#call ⇒ Object Also known as: to_hash_or_array
19 20 21 22 23 24 25 |
# File 'lib/yaoc/mapping_base.rb', line 19 def call unless to_convert.nil? self.class.mapping_strategy.call(self) else nil end end |
#converter_methods ⇒ Object
28 29 30 |
# File 'lib/yaoc/mapping_base.rb', line 28 def converter_methods self.class.converter_methods end |
#fetcher ⇒ Object
32 33 34 |
# File 'lib/yaoc/mapping_base.rb', line 32 def fetcher defined?(super) ? super : :fetch end |
#to_proc ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/yaoc/mapping_base.rb', line 7 def to_proc ->(to_convert)do old_to_convert = self.to_convert begin self.to_convert = to_convert call ensure self.to_convert = old_to_convert end end end |