Class: RailsProcessInterpreter

Inherits:
DslContext show all
Defined in:
lib/RailsProcessInterpreter.rb

Instance Method Summary collapse

Methods inherited from DslContext

bubble, execute, polish_text

Instance Method Details

#endvalid_flows(*args) ⇒ Object



42
43
44
45
# File 'lib/RailsProcessInterpreter.rb', line 42

def endvalid_flows(*args)
  @result << "}\n"
  @result << "end"
end

#endworkflow_stepsObject



20
21
# File 'lib/RailsProcessInterpreter.rb', line 20

def endworkflow_steps
end

#flow(*args) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/RailsProcessInterpreter.rb', line 23

def flow(*args)
  #serialize array
  sarray ="["
  args[1].each do |a|
    if (a == args[1].first)
      sarray << ":#{a}"
    else
      sarray << ",:#{a}"
    end
  end
  sarray << "]"
  @result << ":#{args[0]} => #{sarray},"
end

#getResultObject



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

def getResult
  @result
end

#step(*args) ⇒ Object



47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/RailsProcessInterpreter.rb', line 47

def step(*args)
  #there will be at least five parameters for an IAB app - rails controller, rails action, language, brand, product
  controller_process_step = "if self.respond_to?(:#{args[1][:do].to_s.downcase})\nparams.merge!(#{args[1][:do].to_s.downcase})\nend" if (args[1][:do])
  engine_call = ""
  engine_call << "@results = Communicator.instance.handle(session,\"#{args[1][:do]}\",params)" if (args[1][:do])
  marshalling = ""
  marshalling << "possible_redirect = massage(@results) if @results\nif possible_redirect\nredirect_to possible_redirect\nreturn\nend" if (args[1][:do])
  injectLayoutDict = "introduce_layout_dictionary(\"#{args[1][:template]}\")"
  
  action = "def #{args[0]}\[email protected]({:currentstep => :#{args[0]}})\n#{controller_process_step}\n#{engine_call}\n#{marshalling}\n#{injectLayoutDict}\nrender :template => \"#{args[1][:template]}.oil\", :layout => \"#{args[1][:layout]}\"\nend\n" 
  #puts("introducing controller action\n#{action}")
  @result << action
end

#valid_flows(*args) ⇒ Object



37
38
39
40
# File 'lib/RailsProcessInterpreter.rb', line 37

def valid_flows(*args)
  @result << "def wireProcess\n"
  @result << "@processMap = {"
end

#workflow_stepsObject



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

def workflow_steps
  @result = ""
end