Sha256: 23be33389a6641c5832ebd780a85cbb7690998fbbb5e281a63878ac1a7f4a557

Contents?: true

Size: 1.06 KB

Versions: 30

Compression:

Stored size: 1.06 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)
    class << self
      self
    end.send(:define_method, :"temporary method for instance_exec", &block)
    send(:"temporary method for instance_exec", *arg)
  end unless Object.method_defined?(:instance_exec)

  # 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

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

  module Kernel
    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
end

Version data entries

30 entries across 30 versions & 2 rubygems

Version Path
backports-3.0.3 lib/backports/1.8.7/kernel.rb
backports-3.0.2 lib/backports/1.8.7/kernel.rb
backports-3.0.1 lib/backports/1.8.7/kernel.rb
backports-3.0.0 lib/backports/1.8.7/kernel.rb
backports-2.8.2 lib/backports/1.8.7/kernel.rb
backports-2.8.1 lib/backports/1.8.7/kernel.rb
backports-2.8.0 lib/backports/1.8.7/kernel.rb
backports-2.7.1 lib/backports/1.8.7/kernel.rb
backports-2.7.0 lib/backports/1.8.7/kernel.rb
backports-2.6.7 lib/backports/1.8.7/kernel.rb
backports-2.6.6 lib/backports/1.8.7/kernel.rb
backports-2.6.5 lib/backports/1.8.7/kernel.rb
fragrant-0.0.5 vendor/bundle/ruby/1.9.1/gems/backports-2.6.4/lib/backports/1.8.7/kernel.rb
backports-2.6.4 lib/backports/1.8.7/kernel.rb
backports-2.6.3 lib/backports/1.8.7/kernel.rb
backports-2.6.2 lib/backports/1.8.7/kernel.rb
backports-2.6.1 lib/backports/1.8.7/kernel.rb
backports-2.6.0 lib/backports/1.8.7/kernel.rb
backports-2.5.3 lib/backports/1.8.7/kernel.rb
backports-2.5.2 lib/backports/1.8.7/kernel.rb