class Lab42::Function

Implementation of the isolated functional behavior

- Partials
- Chaining

Constants

VERSION

Attributes

arity[R]
behavior[R]

Public Class Methods

new(behavior, arity=-1) click to toggle source
# File lib/lab42/function.rb, line 28
def initialize behavior, arity=-1
  @behavior = behavior
  @arity    = arity
end

Public Instance Methods

call(*second_stage_params) click to toggle source
# File lib/lab42/function.rb, line 33
def call *second_stage_params
  behavior.(*second_stage_params)
end
|(rhs) click to toggle source
# File lib/lab42/function.rb, line 20
def | rhs
  return call if rhs == self.class.force_pipe
  rhs = MakeFunction.make_function rhs
  self.class.new ->{
    rhs.call(self.call)
  }
end