Class: Transproc::Function::Composite Private

Inherits:
Transproc::Function show all
Defined in:
lib/transproc/function.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Composition of two functions

Instance Attribute Summary collapse

Attributes inherited from Transproc::Function

#args, #fn

Instance Method Summary collapse

Constructor Details

#initialize(fn, options = {}) ⇒ Composite

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Composite.



78
79
80
81
# File 'lib/transproc/function.rb', line 78

def initialize(fn, options = {})
  super
  @right = options.fetch(:right)
end

Instance Attribute Details

#rightProc (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



75
76
77
# File 'lib/transproc/function.rb', line 75

def right
  @right
end

Instance Method Details

#call(value) ⇒ Object Also known as: []

Call right side with the result from the left side



90
91
92
# File 'lib/transproc/function.rb', line 90

def call(value)
  right[left[value]]
end

#compose(other) ⇒ Object Also known as: +, >>



98
99
100
# File 'lib/transproc/function.rb', line 98

def compose(other)
  Composite.new(self, right: other)
end

#to_astObject



107
108
109
# File 'lib/transproc/function.rb', line 107

def to_ast
  left.to_ast << right.to_ast
end