Class: Functional::BottomUp

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

Instance Attribute Summary

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) ⇒ BottomUp

Returns a new instance of BottomUp.



121
122
123
124
# File 'lib/functional.rb', line 121

def initialize start, *a, &e
	@next.call *a, &e
	@buffer, @start = nil, start
end

Instance Method Details

#bottom_up_fun(a) ⇒ Object Also known as: call



126
127
128
129
130
131
132
133
# File 'lib/functional.rb', line 126

def bottom_up_fun a
	if @exe.call a
		@next.call @buffer+a
		@buffer = @start.dup
	else
		@buffer += a
	end
end

#endObject



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

def end
	@next.call @buffer
	@next.end
end