Module: IIRC::Reading

Included in:
Bot
Defined in:
lib/iirc/modules/reading.rb

Instance Method Summary collapse

Instance Method Details

#lines {|String| ... } ⇒ Object

Read lines from #socket in a blocking loop until EOF or an error is raised.

Yields:

  • (String)

    line encoded as UTF-8.

Returns:

  • nil



6
7
8
9
10
# File 'lib/iirc/modules/reading.rb', line 6

def lines
  loop {
    yield socket.readline.force_encoding('utf-8').encode
  }
end