class Proc

Public Class Methods

to_lambda(block) click to toggle source
# File lib/core_extensions.rb, line 193
def self.to_lambda(block)
  raise 'argument is not a Proc' unless block.is_a?(Proc)
  if RUBY_ENGINE && RUBY_ENGINE == "jruby"
    return lambda(&block)
  else
    obj = Object.new
    obj.define_singleton_method(:_, &block)
    return obj.method(:_).to_proc
  end
end

Public Instance Methods

to_lambda() click to toggle source
# File lib/core_extensions.rb, line 204
def to_lambda
  self.class.to_lambda(self)
end