Module: Datacraft::Context
- Included in:
- Instruction
- Defined in:
- lib/datacraft/context.rb
Overview
define the context of the instruction
Instance Method Summary collapse
- #consumers ⇒ Object
- #options ⇒ Object
- #post_hooks ⇒ Object
- #pre_hooks ⇒ Object
- #sources ⇒ Object
- #tweakers ⇒ Object
- #validate ⇒ Object
Instance Method Details
#consumers ⇒ Object
20 21 22 |
# File 'lib/datacraft/context.rb', line 20 def consumers @consumers ||= [] end |
#options ⇒ Object
24 25 26 |
# File 'lib/datacraft/context.rb', line 24 def @options ||= {} end |
#post_hooks ⇒ Object
16 17 18 |
# File 'lib/datacraft/context.rb', line 16 def post_hooks @post_hooks ||= [] end |
#pre_hooks ⇒ Object
12 13 14 |
# File 'lib/datacraft/context.rb', line 12 def pre_hooks @pre_hooks ||= [] end |
#sources ⇒ Object
4 5 6 |
# File 'lib/datacraft/context.rb', line 4 def sources @sources ||= [] end |
#tweakers ⇒ Object
8 9 10 |
# File 'lib/datacraft/context.rb', line 8 def tweakers @tweakers ||= [] end |
#validate ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/datacraft/context.rb', line 28 def validate fail InvalidInstruction, "Please define data source with keyword 'from'." unless sources.size > 0 fail InvalidInstruction, "Please define data consumer with keyword 'to'." unless consumers.size > 0 sources.each(&:validate) consumers.each(&:validate) tweakers.each(&:validate) pre_hooks.each(&:validate) post_hooks.each(&:validate) end |