Sha256: d73992538d45477ca2d053f1a02de39b6328e7963c8982484f2d5588eca04939

Contents?: true

Size: 622 Bytes

Versions: 47

Compression:

Stored size: 622 Bytes

Contents

fd = IO.sysopen(__FILE__)
begin
  IO.open(fd, :mode => 'r'){}
rescue TypeError
  require 'backports/tools/io'
  require 'backports/tools/alias_method_chain'

  class << IO
    def open_with_options_hash(*args)
      if args.size > 2 || args[1].respond_to?(:to_hash)
        fd, mode, options = (args << Backports::Undefined)
        args = [fd, Backports.combine_mode_and_option(mode, options)]
      end
      if block_given?
        open_without_options_hash(*args){|f| yield f}
      else
        open_without_options_hash(*args)
      end
    end

    Backports.alias_method_chain self, :open, :options_hash
  end
end

Version data entries

47 entries across 47 versions & 4 rubygems

Version Path
backports-3.6.7 lib/backports/1.9.1/io/open.rb
backports-3.6.6 lib/backports/1.9.1/io/open.rb
backports-3.6.5 lib/backports/1.9.1/io/open.rb
backports-3.6.4 lib/backports/1.9.1/io/open.rb
backports-3.6.3 lib/backports/1.9.1/io/open.rb
backports-3.6.2 lib/backports/1.9.1/io/open.rb
backports-3.6.1 lib/backports/1.9.1/io/open.rb