voteable-dem 0.0.0 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/voteable-dem.rb +12 -0
- metadata +1 -1
data/lib/voteable-dem.rb
CHANGED
@@ -0,0 +1,12 @@
|
|
1
|
+
def self.included(base)
|
2
|
+
base.send(:include, InstanceMethods)
|
3
|
+
base.extend ClassMethods
|
4
|
+
base.class_eval do
|
5
|
+
my_class_method
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
module InstanceMethods
|
10
|
+
def total_votes
|
11
|
+
self.votes.where(vote: true).size - self.votes.where(vote: false).size
|
12
|
+
end
|