Class: Functional::Inject

Inherits:
Base show all
Defined in:
lib/functional.rb

Direct Known Subclasses

To_a

Instance Attribute Summary collapse

Attributes inherited from Base

#exe, #next

Instance Method Summary collapse

Methods inherited from Base

#to_proc

Constructor Details

#initialize(start, *a, &e) ⇒ Inject



133
134
135
136
# File 'lib/functional.rb', line 133

def initialize start, *a, &e
  super *a, &e
  @it = start
end

Instance Attribute Details

#itObject (readonly)

Returns the value of attribute it.



132
133
134
# File 'lib/functional.rb', line 132

def it
  @it
end

Instance Method Details

#call(*a) ⇒ Object



137
138
139
# File 'lib/functional.rb', line 137

def call *a
  @it = @exe.call @it, *a
end

#endObject



140
141
142
# File 'lib/functional.rb', line 140

def end
  @it
end