Class: Input::Prompt

Inherits:
Object
  • Object
show all
Defined in:
lib/xify/input/prompt.rb

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Prompt

Returns a new instance of Prompt.



3
4
5
# File 'lib/xify/input/prompt.rb', line 3

def initialize(config)
  @author = config['author']
end

Instance Method Details

#updatesObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/xify/input/prompt.rb', line 7

def updates
  loop do
    begin
      input = prompt

      unless input
        raise Interrupt
      end

      if input.length != 1
        yield Xify::Event.new @author, input.chomp
      end
    rescue Interrupt
      raise
    end
  end
end