Sha256: 8e6eea8de3ae29d1bd8d2260d5af3c3752b6dcb5e042b2f385ac04a7901c477c

Contents?: true

Size: 1 KB

Versions: 20

Compression:

Stored size: 1 KB

Contents

module Kernel

  def __method__
    m = caller(1).first[/`(.*)'/,1]
    m.to_sym if m
  end unless (__method__ || true rescue false)

  # Standard in ruby 1.8.7+. See official documentation[http://ruby-doc.org/core-1.9/classes/Object.html]
  def instance_exec(*arg, &block)
    define_singleton_method(:"temporary method for instance_exec", &block)
    send(:"temporary method for instance_exec", *arg)
  end unless method_defined? :instance_exec

  # Loop. Standard in ruby 1.8.7+. See official documentation[http://ruby-doc.org/core-1.9/classes/Object.html]
  unless const_defined? :StopIteration
    class StopIteration < IndexError; end

    def loop_with_stop_iteration(&block)
      loop_without_stop_iteration(&block)
    rescue StopIteration
      # ignore silently
    end
    Backports.alias_method_chain self, :loop, :stop_iteration
  end

  # Standard in ruby 1.8.7. See official documentation[http://ruby-doc.org/core-1.9/classes/Object.html]
  def tap
    yield self
    self
  end unless method_defined? :tap

end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
backports-1.16.7 lib/backports/1.8.7/kernel.rb
backports-1.16.6 lib/backports/1.8.7/kernel.rb
backports-1.16.5 lib/backports/1.8.7/kernel.rb
backports-1.16.4 lib/backports/1.8.7/kernel.rb
backports-1.16.3 lib/backports/1.8.7/kernel.rb
backports-1.16.2 lib/backports/1.8.7/kernel.rb
backports-1.16.1 lib/backports/1.8.7/kernel.rb
backports-1.15.0 lib/backports/1.8.7/kernel.rb
backports-1.14.1 lib/backports/1.8.7/kernel.rb
backports-1.14.0 lib/backports/1.8.7/kernel.rb
backports-1.13.3 lib/backports/1.8.7/kernel.rb
backports-1.13.2 lib/backports/1.8.7/kernel.rb
backports-1.13.1 lib/backports/1.8.7/kernel.rb
backports-1.13.0 lib/backports/1.8.7/kernel.rb
backports-1.12.3 lib/backports/1.8.7/kernel.rb
backports-1.12.2 lib/backports/1.8.7/kernel.rb
backports-1.12.1 lib/backports/1.8.7/kernel.rb
backports-1.12.0 lib/backports/1.8.7/kernel.rb
backports-1.11.1 lib/backports/1.8.7/kernel.rb
backports-1.11.0 lib/backports/1.8.7/kernel.rb