Sha256: 89f5b3699b3f05c86e77170653eaf9c1a4175cd16cba4673eb4ceb98ec84dc03

Contents?: true

Size: 489 Bytes

Versions: 2

Compression:

Stored size: 489 Bytes

Contents

##
# Meta-programming Proc for Syntactic Sugars
class Proc
  # Convert [ Proc ] to [ Lambda ]
  # @param [ Object ] instance the context
  # @return [ Lambda ] Lambda converted
  # @note Converting [Proc] to [Lambda] may have incorrect behaviours on corner cases.
  # @note See {Ruby Language Issues}[https://bugs.ruby-lang.org/issues/7314] for more details.
  def to_lambda (instance = Object.new)
    instance.define_singleton_method(:_, &self)
    instance.method(:_).to_proc
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
em-midori-0.1.7.1 lib/midori/core_ext/proc.rb
em-midori-0.1.7 lib/midori/core_ext/proc.rb