Sha256: 3b61d26240097a9e131000b3b3ac6f61bd0276c0c6488edfef8a1f8e6145409d
Contents?: true
Size: 899 Bytes
Versions: 1
Compression:
Stored size: 899 Bytes
Contents
# -*- encoding : utf-8 -*- require 'strscan' require File.dirname(__FILE__) + "/impls/reader_iobuf" require File.dirname(__FILE__) + "/impls/reader_strbuf" require File.dirname(__FILE__) + "/impls/reader_bare" module Bychar VERSION = '3.0.0' DEFAULT_BUFFER_SIZE = 512 * 1024 # The basic wrapper that you get from wrap() class Wrapper def initialize(io_to_wrap) @io = io_to_wrap end def read_one_char @io.read_one_char end def each_char while char = read_one_char do yield char end end end # Returns a reader object that responds to read_one_char # and can be passed on to the actual parsers 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 end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bychar-3.0.0 | lib/bychar.rb |