Sha256: 96c857977903945f18061eecfd0592bfd082ea7a676eebd30c180a0aecaf9f4f

Contents?: true

Size: 726 Bytes

Versions: 47

Compression:

Stored size: 726 Bytes

Contents

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

  def open_with_options_hash(file, mode = nil, perm_or_options = Backports::Undefined)
    mode, perm = Backports.combine_mode_perm_and_option(mode, perm_or_options)
    perm ||= 0666 # Avoid error on Rubinius, see issue #52
    if block_given?
      open_without_options_hash(file, mode, perm){|f| yield f}
    else
      open_without_options_hash(file, mode, perm)
    end
  end

  class << File
    Backports.alias_method_chain self, :open, :options_hash
  end
end

if RUBY_VERSION < '1.9'
  require 'backports/tools/path'

  Backports.convert_first_argument_to_path File, :open
end

Version data entries

47 entries across 47 versions & 4 rubygems

Version Path
backports-3.25.0 lib/backports/1.9.1/file/open.rb
backports-3.24.1 lib/backports/1.9.1/file/open.rb
backports-3.24.0 lib/backports/1.9.1/file/open.rb
backports-3.23.0 lib/backports/1.9.1/file/open.rb
backports-3.22.1 lib/backports/1.9.1/file/open.rb
backports-3.22.0 lib/backports/1.9.1/file/open.rb
backports-3.21.0 lib/backports/1.9.1/file/open.rb
backports-3.20.2 lib/backports/1.9.1/file/open.rb
backports-3.20.1 lib/backports/1.9.1/file/open.rb
backports-3.20.0 lib/backports/1.9.1/file/open.rb
backports-3.19.0 lib/backports/1.9.1/file/open.rb
backports-3.18.2 lib/backports/1.9.1/file/open.rb
backports-3.18.1 lib/backports/1.9.1/file/open.rb
backports-3.18.0 lib/backports/1.9.1/file/open.rb
files.com-1.0.55 docs/vendor/bundle/ruby/2.5.0/gems/backports-3.12.0/lib/backports/1.9.1/file/open.rb
backports-3.17.2 lib/backports/1.9.1/file/open.rb
backports-3.17.1 lib/backports/1.9.1/file/open.rb
backports-3.17.0 lib/backports/1.9.1/file/open.rb
backports-3.16.1 lib/backports/1.9.1/file/open.rb
backports-3.16.0 lib/backports/1.9.1/file/open.rb