Module: Votes::ActiveRecordExt::VoterInstanceMethods

Defined in:
lib/votes/active_record_ext.rb

Instance Method Summary collapse

Instance Method Details

#power_of_voteObject



14
15
16
17
18
19
20
21
22
23
# File 'lib/votes/active_record_ext.rb', line 14

def power_of_vote
  voter_power_of_vote = self.class.instance_variable_get(:@voter_power_of_vote)
  if voter_power_of_vote.is_a?(Numeric)
    voter_power_of_vote
  elsif voter_power_of_vote.is_a?(Proc)
    self.instance_exec(&voter_power_of_vote)
  else
    self.send(voter_power_of_vote)
  end
end