Module: Bychar

Defined in:
lib/bychar.rb,
lib/impls/reader_bare.rb,
lib/impls/reader_iobuf.rb,
lib/impls/reader_strbuf.rb

Defined Under Namespace

Classes: ReaderBare, ReaderIOBuf, ReaderStrbuf, Wrapper

Constant Summary collapse

VERSION =
'3.0.0'
DEFAULT_BUFFER_SIZE =
512 * 1024

Class Method Summary collapse

Class Method Details

.wrap(io) ⇒ Object

Returns a reader object that responds to read_one_char and can be passed on to the actual parsers



31
32
33
34
35
36
37
38
39
40
# File 'lib/bychar.rb', line 31

def self.wrap(io)
  reader = if RUBY_PLATFORM == 'java'
    ReaderIOBuf.new(io)
  elsif RUBY_VERSION < '1.9'
    ReaderBare.new(io)
  else
    ReaderStrbuf.new(io)
  end
  Wrapper.new(reader)
end