Class: Windstorm::Executor

Inherits:
Object
  • Object
show all
Extended by:
Reader
Includes:
Reader
Defined in:
lib/windstorm/executor.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#parserObject



44
45
46
47
# File 'lib/windstorm/executor.rb', line 44

def parser
  raise 'parser not found' unless @parser
  @parser
end

Class Method Details

.create(pa) ⇒ Object



35
36
37
38
39
40
# File 'lib/windstorm/executor.rb', line 35

def create(pa)
  return unless pa
  ex = self.new
  ex.parser = pa
  ex
end

.create_from_file(file) ⇒ Object



27
28
29
# File 'lib/windstorm/executor.rb', line 27

def create_from_file(file)
  create_from_table(yaml_read(file))
end

.create_from_table(t) ⇒ Object



31
32
33
# File 'lib/windstorm/executor.rb', line 31

def create_from_table(t)
  create(Parser.create(t))
end

Instance Method Details

#build(source) ⇒ Object



71
72
73
# File 'lib/windstorm/executor.rb', line 71

def build(source)
  parser.build(source)
end

#build_from_file(file) ⇒ Object



75
76
77
# File 'lib/windstorm/executor.rb', line 75

def build_from_file(file)
  build(read(file))
end

#debug_execute(source, params = nil) ⇒ Object



79
80
81
# File 'lib/windstorm/executor.rb', line 79

def debug_execute(source, params = nil)
  execute(source, {:debug => true}.merge(params || {}))
end

#debug_execute_from_file(file, params = nil) ⇒ Object



83
84
85
# File 'lib/windstorm/executor.rb', line 83

def debug_execute_from_file(file, params = nil)
  debug_execute(read(file), params)
end

#execute(source, params = nil) ⇒ Object



54
55
56
57
# File 'lib/windstorm/executor.rb', line 54

def execute(source, params = nil)
  @machine = Machine.create(parser.build(source), params)
  @machine.execute
end

#execute_from_file(file, params = nil) ⇒ Object



59
60
61
# File 'lib/windstorm/executor.rb', line 59

def execute_from_file(file, params = nil)
  execute(read(file), params)
end

#filter(source) ⇒ Object



63
64
65
# File 'lib/windstorm/executor.rb', line 63

def filter(source)
  parser.filter(source)
end

#filter_from_file(file) ⇒ Object



67
68
69
# File 'lib/windstorm/executor.rb', line 67

def filter_from_file(file)
  filter(read(file))
end

#machineObject



49
50
51
52
# File 'lib/windstorm/executor.rb', line 49

def machine
  raise 'not executed yet' unless @machine
  @machine
end