Class: Tarzan::Interfaces::Campfire::Interface

Inherits:
Base::Interface show all
Defined in:
lib/tarzan/interfaces/campfire/interface.rb

Instance Method Summary collapse

Methods inherited from Base::Interface

#play

Constructor Details

#initialize(options = {}) ⇒ Interface

Returns a new instance of Interface.



9
10
11
# File 'lib/tarzan/interfaces/campfire/interface.rb', line 9

def initialize(options = {})
  @room = Nico::Room.new options
end

Instance Method Details

#prompt(valid_choices = []) ⇒ Object



17
18
19
20
21
22
# File 'lib/tarzan/interfaces/campfire/interface.rb', line 17

def prompt(valid_choices = [])
  say %{Pick one: #{valid_choices.join ' - '} }
  @room.each_message do |message|
    return message if valid_choices.include?(message)
  end
end

#say(message) ⇒ Object



13
14
15
# File 'lib/tarzan/interfaces/campfire/interface.rb', line 13

def say(message)
  @room.say message
end