Class: Juman::Process

Inherits:
Object
  • Object
show all
Defined in:
lib/juman/process.rb

Instance Method Summary collapse

Constructor Details

#initialize(command) ⇒ Process

Returns a new instance of Process.



3
4
5
# File 'lib/juman/process.rb', line 3

def initialize(command)
  @io = IO.popen(command, 'r+')
end

Instance Method Details

#parse_to_enum(text) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/juman/process.rb', line 7

def parse_to_enum(text)
  @io.puts(text)
  Enumerator.new do |y|
    until @io.gets[/^EOS$/]
      y << $_
    end
  end
end