Module: Verifly::ClassBuilder::Mixin
- Included in:
- Applicator
- Defined in:
- lib/verifly/class_builder.rb
Overview
Mixin provides useful methods to integrate into builder subsystem. Feel free to override or just never include it.
Instance Method Summary collapse
-
#build(*arguments, &block) ⇒ Object
Default implementation.
-
#build_class(*args, &block) ⇒ Object
Default implementation of build_class.
-
#buildable_classes=(klasses) ⇒ Object
Array of classes which will be checked if they suite constructor arguments.
Instance Method Details
#build(*arguments, &block) ⇒ Object
Default implementation. This method should be used instead of new in all cases
36 37 38 |
# File 'lib/verifly/class_builder.rb', line 36 def build(*arguments, &block) build_class(*arguments, &block).new(*arguments, &block) end |
#build_class(*args, &block) ⇒ Object
Default implementation of build_class. Feel free to change it, but you’ll have to override it in buildable_classes
26 27 28 29 30 31 32 |
# File 'lib/verifly/class_builder.rb', line 26 def build_class(*args, &block) if @class_builder @class_builder.call(*args, &block) else self end end |
#buildable_classes=(klasses) ⇒ Object
Array of classes which will be checked if they suite constructor arguments. Order matters
19 20 21 |
# File 'lib/verifly/class_builder.rb', line 19 def buildable_classes=(klasses) @class_builder = ClassBuilder.new(klasses).freeze end |