Module: RedisVoteable

Extended by:
ActiveSupport::Concern
Defined in:
lib/redis_voteable.rb,
lib/redis_voteable/voter.rb,
lib/redis_voteable/version.rb,
lib/redis_voteable/voteable.rb,
lib/redis_voteable/exceptions.rb

Defined Under Namespace

Modules: ClassMethods, Exceptions, Voteable, Voter

Constant Summary

UP_VOTERS =
"up_voters"
DOWN_VOTERS =
"dn_voters"
UP_VOTES =
"up_votes"
DOWN_VOTES =
"dn_votes"
VERSION =
"0.1.2"
@@redis_voteable_settings =
{
      :host => 'localhost',
      :port => '6379',
      :db => 0,
      :key_prefix => 'vote:',
}

Instance Method Summary collapse

Instance Method Details

#class_key(v) ⇒ Object



35
36
37
# File 'lib/redis_voteable.rb', line 35

def class_key(v)
  "#{v.class.name}:#{v.id}"
end

#prefixed(sid) ⇒ Object

@@redis =



31
32
33
# File 'lib/redis_voteable.rb', line 31

def prefixed(sid)
  "#{@@redis_voteable_settings[:key_prefix]}#{sid}"
end

#redis_voteable_settings=(new_settings) ⇒ Object



24
25
26
# File 'lib/redis_voteable.rb', line 24

def redis_voteable_settings=(new_settings)
  @@redis_voteable_settings.update(new_settings)
end