class Bud::PushSort

Public Class Methods

new(elem_name=nil, bud_instance=nil, collection_name=nil, schema_in=nil, &blk) click to toggle source
Calls superclass method Bud::PushElement::new
# File lib/bud/executor/elements.rb, line 415
def initialize(elem_name=nil, bud_instance=nil, collection_name=nil,
               schema_in=nil, &blk)
  super(elem_name, bud_instance, collection_name, schema_in, &blk)
  @sortbuf = []
  @seen_new_input = false
end

Public Instance Methods

flush() click to toggle source
# File lib/bud/executor/elements.rb, line 427
def flush
  if @seen_new_input || @rescan
    @sortbuf.sort!(&@blk)
    @sortbuf.each do |t|
      push_out(t, false)
    end
    @seen_new_input = false
    @rescan = false
  end
end
insert(item, source) click to toggle source
# File lib/bud/executor/elements.rb, line 422
def insert(item, source)
  @sortbuf << item
  @seen_new_input = true
end
invalidate_cache() click to toggle source
# File lib/bud/executor/elements.rb, line 438
def invalidate_cache
  @sortbuf.clear
end