Module: Yaoc::BuilderDSLMethods
- Included in:
- ConverterBuilder
- Defined in:
- lib/yaoc/converter_builder.rb
Instance Method Summary collapse
- #add_mapping(&block) ⇒ Object
- #build_commands_ordered ⇒ Object
- #fetch_with(new_fetcher) ⇒ Object
- #rule(to: nil, from: to, converter: nil, object_converter: nil, is_collection: nil, lazy_loading: nil) ⇒ Object
- #with_strategy(new_strategy) ⇒ Object
Instance Method Details
#add_mapping(&block) ⇒ Object
58 59 60 61 |
# File 'lib/yaoc/converter_builder.rb', line 58 def add_mapping(&block) instance_eval &block apply_commands! end |
#build_commands_ordered ⇒ Object
79 80 81 82 83 84 85 |
# File 'lib/yaoc/converter_builder.rb', line 79 def build_commands_ordered if command_order == :recorded_order build_commands else build_commands.reverse end end |
#fetch_with(new_fetcher) ⇒ Object
71 72 73 |
# File 'lib/yaoc/converter_builder.rb', line 71 def fetch_with(new_fetcher) self.fetcher = new_fetcher end |
#rule(to: nil, from: to, converter: nil, object_converter: nil, is_collection: nil, lazy_loading: nil) ⇒ Object
63 64 65 66 67 68 69 |
# File 'lib/yaoc/converter_builder.rb', line 63 def rule(to: nil, from: to, converter: nil, object_converter: nil, is_collection: nil, lazy_loading: nil) self.all_commands_applied = false NormalizedParameters.new(to, from, converter, object_converter, is_collection, lazy_loading).each do |to, from, converter, lazy_loading| build_commands.push ->{ converter_class.map(to: to, from: from , converter: converter, lazy_loading: lazy_loading) } end end |
#with_strategy(new_strategy) ⇒ Object
75 76 77 |
# File 'lib/yaoc/converter_builder.rb', line 75 def with_strategy(new_strategy) self.strategy = new_strategy end |