Class: Transproc::Function
- Inherits:
-
Object
- Object
- Transproc::Function
- Defined in:
- lib/transproc.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#fn ⇒ Object
readonly
Returns the value of attribute fn.
Instance Method Summary collapse
- #call(value) ⇒ Object (also: #[])
- #compose(other) ⇒ Object (also: #+)
-
#initialize(fn, args = []) ⇒ Function
constructor
A new instance of Function.
Constructor Details
#initialize(fn, args = []) ⇒ Function
Returns a new instance of Function.
20 21 22 23 |
# File 'lib/transproc.rb', line 20 def initialize(fn, args = []) @fn = fn @args = args end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
18 19 20 |
# File 'lib/transproc.rb', line 18 def args @args end |
#fn ⇒ Object (readonly)
Returns the value of attribute fn.
18 19 20 |
# File 'lib/transproc.rb', line 18 def fn @fn end |
Instance Method Details
#call(value) ⇒ Object Also known as: []
25 26 27 |
# File 'lib/transproc.rb', line 25 def call(value) fn[value, *args] end |
#compose(other) ⇒ Object Also known as: +
30 31 32 |
# File 'lib/transproc.rb', line 30 def compose(other) self.class.new(-> value { other[fn[value]] }) end |