class Almicube::Selector::HasManySelector

Attributes

association_name[R]
target[R]

Public Class Methods

new(options={}) click to toggle source
Calls superclass method Almicube::Selector::Base::new
# File lib/almicube/selector/has_many_selector.rb, line 7
def initialize(options={})
  super(options)

  @target = options[:target]
  @association_name = options[:association_name]
end

Public Instance Methods

before_aggregate() click to toggle source
# File lib/almicube/selector/has_many_selector.rb, line 22
def before_aggregate
  records.map{ |r| r.to_param }.each do |i|
    Config.config.connection.zadd(interstore_key, 0, i)
  end
end
interstore() click to toggle source
# File lib/almicube/selector/has_many_selector.rb, line 28
def interstore
  interstore_key
end
label() click to toggle source
# File lib/almicube/selector/has_many_selector.rb, line 18
def label
  "#{target.class.to_s.underscore}-#{target.to_param}"
end
records() click to toggle source
# File lib/almicube/selector/has_many_selector.rb, line 14
def records
  target.send(association_name)
end

Protected Instance Methods

interstore_key() click to toggle source
# File lib/almicube/selector/has_many_selector.rb, line 34
def interstore_key
  _key = ranking.key
  _key[:distinction] = label
  _key[:suffix] = ""
  _key
end