class Almicube::AssociationProxy

Public Class Methods

new(ranking, item) click to toggle source
# File lib/almicube/proxy/association_proxy.rb, line 3
def initialize(ranking, item)
  raise TypeError, "without the Almicube::Ranking as #1 argument" unless ranking.kind_of? Ranking::Base
  @item = item
  @ranking = ranking
end

Public Instance Methods

incr(score = 1) click to toggle source
# File lib/almicube/proxy/association_proxy.rb, line 17
def incr(score = 1)
  @ranking.incr(@item, score)
end
rank() click to toggle source
# File lib/almicube/proxy/association_proxy.rb, line 13
def rank
  @ranking.rank(@item)
end
score() click to toggle source
# File lib/almicube/proxy/association_proxy.rb, line 9
def score
  @ranking.score(@item)
end
to_s() click to toggle source
# File lib/almicube/proxy/association_proxy.rb, line 21
def to_s
  "#{@item.to_s}: #{@ranking.key} [#{rank} - #{score}]"
end