Sha256: cc72af743a3b2a961b6ad15157586c29abcf6dc05b1ebe9bdf2ccf945ba6c370

Contents?: true

Size: 507 Bytes

Versions: 3

Compression:

Stored size: 507 Bytes

Contents

class IO
  class << self
    def binread(file, *arg)
      raise ArgumentError, "wrong number of arguments (#{1+arg.size} for 1..3)" unless arg.size < 3
      File.open(Backports.convert_to_path(file),"rb") do |f|
        f.read(*arg)
      end
    end unless method_defined? :binread

    def try_convert(obj)
      return nil unless obj.respond_to?(:to_io)
      Backports.coerce_to(obj, IO, :to_io)
    end unless method_defined? :try_convert
  end

  Backports.alias_method self, :ungetbyte, :ungetc
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
backports-2.3.0 lib/backports/1.9.1/io.rb
backports-2.2.1 lib/backports/1.9.1/io.rb
backports-2.2.0 lib/backports/1.9.1/io.rb