Class: Magicka::Aggregator::MethodBuilder Private
- Inherits:
-
Sinclair
- Object
- Sinclair
- Magicka::Aggregator::MethodBuilder
- Defined in:
- lib/magicka/aggregator/method_builder.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Class responsible for building an Magicka::Aggregator method
Instance Method Summary collapse
-
#initialize(klass, element_class, method_name = nil, template: nil) ⇒ MethodBuilder
constructor
private
A new instance of MethodBuilder.
-
#prepare ⇒ Aggregator::MethodBuilder
private
Prepare methods to be built.
Constructor Details
#initialize(klass, element_class, method_name = nil, template: nil) ⇒ MethodBuilder
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of MethodBuilder.
16 17 18 19 20 21 22 |
# File 'lib/magicka/aggregator/method_builder.rb', line 16 def initialize(klass, element_class, method_name = nil, template: nil) super(klass) @element_class = element_class @method_name = method_name @template = template end |
Instance Method Details
#prepare ⇒ Aggregator::MethodBuilder
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Prepare methods to be built
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/magicka/aggregator/method_builder.rb', line 27 def prepare element_klass = element_class template_file = template add_method(method_name) do |field, model: self.model, **args| element_klass.render( renderer: renderer, field: field, model: model, template: template_file, **args ) end self end |