Class: Functional::TopDown
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) ⇒ TopDown
Returns a new instance of TopDown.
143
144
145
146
|
# File 'lib/functional.rb', line 143
def initialize start, *a, &e
@next.call *a, &e
@buffer, @start = nil, start
end
|
Instance Method Details
158
159
160
161
|
# File 'lib/functional.rb', line 158
def end
@next.call @buffer
@next.end
end
|
#top_down_fun(a) ⇒ Object
Also known as:
call
148
149
150
151
152
153
154
155
|
# File 'lib/functional.rb', line 148
def top_down_fun a
if @exe.call a
@next.call @buffer
@buffer = @start.dup+a
else
@buffer += a
end
end
|