Sha256: 67a89c1be5bf4a9843186573bbef6abbfa630be41e1459ac12860b2a9f48946c

Contents?: true

Size: 580 Bytes

Versions: 2

Compression:

Stored size: 580 Bytes

Contents

require_relative "tuvi/version"
require_relative "tuvi/step"

module Tuvi

  def step(position, &block)
    @steps ||= {}
    @steps[position] = Step.new(position, &block)
  end

  def run
    current_step = 1
    while true do
      puts @steps[current_step].get_message
      exit if @steps[current_step].exit_program
      input = gets.downcase.chomp
      if @steps[current_step].answer_paths[input]
        current_step = @steps[current_step].answer_paths[input]
      else
        puts "Sorry, I don't understand that answer. Please try again:"
      end
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tuvi-0.0.2 lib/tuvi.rb
tuvi-0.0.1 lib/tuvi.rb