Class: Functional::Slice
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(n) ⇒ Slice
Returns a new instance of Slice.
259
260
261
|
# File 'lib/functional.rb', line 259
def initialize n
@buf, @n = [], n
end
|
Instance Method Details
272
273
274
275
|
# File 'lib/functional.rb', line 272
def end
@next.call @buf
@next.end
end
|
#slice_fun(*a) ⇒ Object
Also known as:
call
263
264
265
266
267
268
269
|
# File 'lib/functional.rb', line 263
def slice_fun *a
@buf.push a
unless @n > @buf.size
@next.call @buf
@buf.clear
end
end
|