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.



5
6
7
# File 'lib/xify/input/prompt.rb', line 5

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

Instance Method Details

#updatesObject



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

def updates
  loop do
    begin
      input = prompt

      unless input
        raise Interrupt
      end

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