Module: IIRC::PrintIO

Defined in:
lib/iirc/modules/print_io.rb

Overview

Wraps Reading#lines and Bot#<< to print lines received and sent to stdout. Useful for debugging.

Instance Method Summary collapse

Instance Method Details

#<<(line) ⇒ self

Prints << #{line} to stdout, then calls super

Returns:

  • (self)


12
13
14
15
# File 'lib/iirc/modules/print_io.rb', line 12

def <<(line)
  puts "<< #{line}"
  super
end

#linesObject

Prints >> #{line} to stdout, then yields, for each line from super.



6
7
8
# File 'lib/iirc/modules/print_io.rb', line 6

def lines
  super { |line| puts ">> #{line}"; yield line }
end