Module: Functional

Included in:
Method, Proc
Defined in:
lib/reducers/functional.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#complementObject



19
20
21
# File 'lib/reducers/functional.rb', line 19

def complement
lambda {|*args| not self.call(*args) }
end

#compose(other) ⇒ Object Also known as: *



23
24
25
# File 'lib/reducers/functional.rb', line 23

def compose(other)
  lambda {|*args| call(other.call(*args)) }
end

#identityObject



3
4
5
# File 'lib/reducers/functional.rb', line 3

def identity
  ->x{ x}
end

#pipe(other) ⇒ Object Also known as: >>



27
28
29
# File 'lib/reducers/functional.rb', line 27

def pipe(other)
  other.compose(self)
end