Class: Proc
- Inherits:
-
Object
- Object
- Proc
- Defined in:
- lib/midori/core_ext/proc.rb
Overview
Meta-programming Proc for Syntactic Sugars
Instance Method Summary collapse
-
#to_lambda(instance = Object.new) ⇒ Lambda
Convert [Proc] to [Lambda].
Instance Method Details
#to_lambda(instance = Object.new) ⇒ Lambda
Note:
Converting [Proc] to [Lambda] may have incorrect behaviours on corner cases.
Note:
See Ruby Language Issues for more details.
Convert [Proc] to [Lambda]
9 10 11 12 |
# File 'lib/midori/core_ext/proc.rb', line 9 def to_lambda(instance = Object.new) instance.define_singleton_method(:_, &self) instance.method(:_).to_proc end |