Sha256: 507d440cffa891a7b0bca3ff77ecd661144b1e67ed8722f1a06d2975153d602f

Contents?: true

Size: 808 Bytes

Versions: 14

Compression:

Stored size: 808 Bytes

Contents

module Kernel
  # Standard in ruby 1.9.
  def require_relative(relative_feature)
    # Adapted from Pragmatic's "Programming Ruby" (since their version was buggy...)
    file = caller.first.split(/:\d/,2).first
    if /\A\((.*)\)/ =~ file # eval, etc. 
      raise LoadError, "require_relative is called in #{$1}" 
    end 
    require File.expand_path(relative_feature, File.dirname(file))
  end unless method_defined? :require_relative
end

class Array
  # Standard in rails, and we use it in module.
  def extract_options!
    last.is_a?(::Hash) ? pop : {}
  end unless method_defined? :extract_options!
end

%w(object module kernel object_space array enumerable enumerator string symbol integer fixnum hash proc binding dir io method regexp struct).each do |lib|
  require_relative "backports/#{lib}"
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
marcandre-backports-1.6.0 lib/backports.rb
marcandre-backports-1.6.1 lib/backports.rb
marcandre-backports-1.6.3 lib/backports.rb
marcandre-backports-1.6.4 lib/backports.rb
marcandre-backports-1.6.6 lib/backports.rb
marcandre-backports-1.6.7 lib/backports.rb
marcandre-backports-1.6.8 lib/backports.rb
backports-1.6.3 lib/backports.rb
backports-1.6.8 lib/backports.rb
backports-1.6.4 lib/backports.rb
backports-1.6.7 lib/backports.rb
backports-1.6.0 lib/backports.rb
backports-1.6.1 lib/backports.rb
backports-1.6.6 lib/backports.rb