Sha256: b1e44ad428ea0e1b245c34ff009f58fcc917c83edcd01cf31d2a6ebd8fa47ca5
Contents?: true
Size: 748 Bytes
Versions: 4
Compression:
Stored size: 748 Bytes
Contents
module IndifferentReader class DataError < StandardError attr_reader :data def initialize message, data @data = data super(message) end end module IOString require 'stringio' def read size @string_io ||= StringIO.new(self) @string_io.read(size) end end def read_from io_or_string, size if io_or_string.kind_of? String io_or_string.extend IOString end if io_or_string.respond_to? :read result = io_or_string.read(size) elsif io_or_string.nil? raise DataError.new("Perhaps DATA has ended? check your FHP.", io_or_string) else raise "Unknown source: #{io_or_string.inspect}" end return result end extend self end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
elia-2.4.2.pre | lib/indifferent_reader.rb |
elia-2.4.1 | lib/indifferent_reader.rb |
elia-2.3.2 | lib/indifferent_reader.rb |
elia-1.2.0 | lib/indifferent_reader.rb |