Class: Pokeberu::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/pokeberu/runner.rb

Constant Summary collapse

BYE =
'17501068'

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRunner

Returns a new instance of Runner.



9
10
11
12
# File 'lib/pokeberu/runner.rb', line 9

def initialize
  @converter = Pokeberu::Converter.new
  @decorator = Pokeberu::Decorator.new
end

Class Method Details

.runObject



5
6
7
# File 'lib/pokeberu/runner.rb', line 5

def self.run
  self.new.run
end

Instance Method Details

#runObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/pokeberu/runner.rb', line 14

def run
  loop do
    print 'メッセージを入力してください (h=help, q=quit): '
    input = gets.chomp
    case input
    when ?q
      show_pokberu(BYE)
      break
    when ?h
      puts @converter.help
      puts
    else
      show_pokberu(input)
    end
  end
end