Class: Datacraft::Instruction
- Inherits:
-
Object
- Object
- Datacraft::Instruction
- Includes:
- Context
- Defined in:
- lib/datacraft/instruction.rb
Overview
Building Instruction
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
Instance Method Summary collapse
- #from(klass, *initialization_params) ⇒ Object
-
#initialize ⇒ Instruction
constructor
A new instance of Instruction.
- #post_build(&block) ⇒ Object
- #pre_build(&block) ⇒ Object
- #set(key, value) ⇒ Object
- #to(klass, *initialization_params) ⇒ Object
- #tweak(klass = nil, *initialization_params, &block) ⇒ Object
Methods included from Context
#consumers, #options, #post_hooks, #pre_hooks, #sources, #tweakers, #validate
Constructor Details
#initialize ⇒ Instruction
Returns a new instance of Instruction.
7 8 9 10 11 |
# File 'lib/datacraft/instruction.rb', line 7 def initialize [:parallel] = false [:benchmark] = false [:n_threads] = 8 end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
5 6 7 |
# File 'lib/datacraft/instruction.rb', line 5 def context @context end |
Instance Method Details
#from(klass, *initialization_params) ⇒ Object
17 18 19 |
# File 'lib/datacraft/instruction.rb', line 17 def from(klass, *initialization_params) sources << Source.new(klass: klass, args: initialization_params) end |
#post_build(&block) ⇒ Object
29 30 31 |
# File 'lib/datacraft/instruction.rb', line 29 def post_build(&block) post_hooks << Hook.new(block: block) end |
#pre_build(&block) ⇒ Object
13 14 15 |
# File 'lib/datacraft/instruction.rb', line 13 def pre_build(&block) pre_hooks << Hook.new(block: block) end |
#set(key, value) ⇒ Object
33 34 35 |
# File 'lib/datacraft/instruction.rb', line 33 def set(key, value) [key.to_sym] = value end |