Module: Kernel

Defined in:
lib/jets/core_ext/kernel.rb

Overview

Works with jets/io.rb

Constant Summary collapse

@@io_buffer =
[]

Instance Method Summary collapse

Instance Method Details

#io_bufferObject

TODO: implement other methods that write output: p, print, printf, putc, puts, sprintf? Also, would be nice to figure out pp method also.



15
16
17
# File 'lib/jets/core_ext/kernel.rb', line 15

def io_buffer
  @@io_buffer
end

#io_flushObject



19
20
21
22
# File 'lib/jets/core_ext/kernel.rb', line 19

def io_flush
  IO.write("/tmp/jets-output.log", @@io_buffer.join("\n"))
  @@io_buffer = []
end

#original_putsObject



5
# File 'lib/jets/core_ext/kernel.rb', line 5

alias_method :original_puts, :puts

#puts(message) ⇒ Object



6
7
8
9
# File 'lib/jets/core_ext/kernel.rb', line 6

def puts(message)
  @@io_buffer << message
  original_puts(message)
end