Class: HTTY::CLI::InputDevice::Pipe

Inherits:
Object
  • Object
show all
Defined in:
lib/htty/cli/input_device.rb

Instance Method Summary collapse

Constructor Details

#initialize(display) ⇒ Pipe

Returns a new instance of Pipe.



14
15
16
# File 'lib/htty/cli/input_device.rb', line 14

def initialize(display)
  @display = display
end

Instance Method Details

#commandsObject



18
19
20
21
22
23
24
25
26
# File 'lib/htty/cli/input_device.rb', line 18

def commands
  STDIN.each_line do |command_line|
    command_line.chomp!
    command_line.strip!
    next if command_line.empty?
    @display.line(command_line)
    yield command_line
  end
end