class Step
Attributes
code_blocks[RW]
exit_program[RW]
id[RW]
response_paths[RW]
Public Class Methods
new(id, &block)
click to toggle source
# File lib/tuvi/step.rb, line 5 def initialize(id, &block) @id = id @response_paths = {} @code_blocks = [] instance_eval(&block) if block_given? end
Public Instance Methods
code(&block)
click to toggle source
# File lib/tuvi/step.rb, line 34 def code(&block) code_blocks << block end
formatted_responses()
click to toggle source
# File lib/tuvi/step.rb, line 30 def formatted_responses "Choose a command: [#{@response_paths.keys.join(", ")}]" end
get_say()
click to toggle source
# File lib/tuvi/step.rb, line 16 def get_say @say end
response(response_path)
click to toggle source
# File lib/tuvi/step.rb, line 20 def response(response_path) response = response_path.first[0].downcase next_step = response_path.first[1] @response_paths[response] = next_step end
say(text)
click to toggle source
# File lib/tuvi/step.rb, line 12 def say(text) @say = text end
stop()
click to toggle source
# File lib/tuvi/step.rb, line 26 def stop @exit_program = true end