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

#caller, #exe, #next

Instance Method Summary collapse

Methods inherited from Base

#base_fun, #clean, #to_proc

Constructor Details

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

Returns a new instance of Inject.



186
187
188
189
# File 'lib/functional.rb', line 186

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

Instance Attribute Details

#itObject (readonly) Also known as: end

Returns the value of attribute it.



183
184
185
# File 'lib/functional.rb', line 183

def it
  @it
end

Instance Method Details

#inject_fun(*a) ⇒ Object Also known as: call



191
192
193
# File 'lib/functional.rb', line 191

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