Class: Babl::Utils::Proc

Inherits:
Object
  • Object
show all
Defined in:
lib/babl/utils/proc.rb

Class Method Summary collapse

Class Method Details

.constant(value) ⇒ Object

Create a lambda returning a constant.



12
13
14
# File 'lib/babl/utils/proc.rb', line 12

def constant(value)
    -> { value }
end

.selfify(proc) ⇒ Object

Wrap a proc in a lambda, so that it is executed in the context of its first (and only) argument.



7
8
9
# File 'lib/babl/utils/proc.rb', line 7

def selfify(proc)
    ->(this) { this.instance_exec(&proc) }
end