Parent

Methods

Files

Class/Module Index [+]

Quicksearch

Tarantool::EMDB::Concatter

Public Class Methods

new(count, feed) click to toggle source
# File lib/tarantool/em_db.rb, line 134
def initialize(count, feed)
  @result = []
  @count = count
  @feed = feed
end

Public Instance Methods

call(array) click to toggle source
# File lib/tarantool/em_db.rb, line 139
def call(array)
  if @count > 0
    case array
    when Array
      @result.concat array
    when Exception
      @result = array
      @count = 1
    else
      @result << array
    end
    if (@count -= 1) == 0
      if Array === @result && Integer === @result.first
        @feed.call @result.inject(0){|s, i| s + i}
      else
        @feed.call @result
      end
    end
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.