class Turn::BucketMap

Attributes

buckets[RW]
count[RW]

Public Class Methods

new(term) click to toggle source
# File lib/turn/bucket_map.rb, line 9
def initialize(term)
  @term = term
  @buckets = []
  @count = 0
end

Public Instance Methods

load(dc) click to toggle source
# File lib/turn/bucket_map.rb, line 15
def load(dc)
  parse(@term.dump_bucket_map(dc))
end
parse(map) click to toggle source
# File lib/turn/bucket_map.rb, line 19
def parse(map)
  map.each_with_index do |bucket, index|
    if /(?<id>\S+):\s+(?<value>\d+)/ =~ bucket
      @count = value.to_i
      @buckets[index] = id
    end
  end
end