Module: Streeem

Defined in:
lib/streeem.rb,
lib/streeem/version.rb

Constant Summary collapse

VERSION =
"0.0.2"

Class Method Summary collapse

Class Method Details

.doObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/streeem.rb', line 4

def self.do
  stdin_sync = $stdin.sync
  stdout_sync = $stdout.sync

  $stdin.sync = true
  $stdout.sync = true

  if block_given?
    $stdin.each {|line|
      $stdout.write "#{yield(line.strip)}\n"
    }
  end

  $stdin.sync = stdin_sync
  $stdout.sync = stdout_sync
end