Module: Datacraft::Context

Included in:
Instruction
Defined in:
lib/datacraft/context.rb

Overview

define the context of the instruction

Instance Method Summary collapse

Instance Method Details

#consumersObject



20
21
22
# File 'lib/datacraft/context.rb', line 20

def consumers
  @consumers ||= []
end

#optionsObject



24
25
26
# File 'lib/datacraft/context.rb', line 24

def options
  @options ||= {}
end

#post_hooksObject



16
17
18
# File 'lib/datacraft/context.rb', line 16

def post_hooks
  @post_hooks ||= []
end

#pre_hooksObject



12
13
14
# File 'lib/datacraft/context.rb', line 12

def pre_hooks
  @pre_hooks ||= []
end

#sourcesObject



4
5
6
# File 'lib/datacraft/context.rb', line 4

def sources
  @sources ||= []
end

#tweakersObject



8
9
10
# File 'lib/datacraft/context.rb', line 8

def tweakers
  @tweakers ||= []
end

#validateObject



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