voteable_dave_jul 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/voteable_dave_jul.rb +30 -30
- metadata +7 -9
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4eaf1930dbcb3e0dabb6ca4e46650b5deb1cb2ca
|
4
|
+
data.tar.gz: fd98cca64445555946ab4cba2c5742fec666cde9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ba2d3992bed23afae5b24f9da5f1333bb8b9bf814463a51584c24bd040e2540a5ec5b64ec732ccaba06f77eb005cf8a8fa5c3df9d1bba416bb651244ee62b7ff
|
7
|
+
data.tar.gz: a010b0fc948c6dcbd337597083606bc1066b850c6af15e0ae18273bbd5a60c7cc09ebf3c28ef749582abbded1d294739dfd06de4da2921401509e94c591c0ef0
|
data/lib/voteable_dave_jul.rb
CHANGED
@@ -1,30 +1,30 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
# module for counting votes
|
4
|
-
module VoteableDaveJul
|
5
|
-
extend ActiveSupport::Concern
|
6
|
-
|
7
|
-
# executes this code when included only once
|
8
|
-
included do
|
9
|
-
has_many :votes, as: :voteable
|
10
|
-
end
|
11
|
-
|
12
|
-
# handles counting votes for comments and posts
|
13
|
-
def total_votes
|
14
|
-
|
15
|
-
end
|
16
|
-
|
17
|
-
def up_votes
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
def down_votes
|
22
|
-
|
23
|
-
end
|
24
|
-
|
25
|
-
# module ClassMethods
|
26
|
-
# def my_class_method
|
27
|
-
|
28
|
-
# end
|
29
|
-
# end
|
30
|
-
end
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
# module for counting votes
|
4
|
+
module VoteableDaveJul
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
# executes this code when included only once
|
8
|
+
included do
|
9
|
+
has_many :votes, as: :voteable
|
10
|
+
end
|
11
|
+
|
12
|
+
# handles counting votes for comments and posts
|
13
|
+
def total_votes
|
14
|
+
up_votes - down_votes
|
15
|
+
end
|
16
|
+
|
17
|
+
def up_votes
|
18
|
+
votes.where(vote: true).size
|
19
|
+
end
|
20
|
+
|
21
|
+
def down_votes
|
22
|
+
votes.where(vote: false).size
|
23
|
+
end
|
24
|
+
|
25
|
+
# module ClassMethods
|
26
|
+
# def my_class_method
|
27
|
+
|
28
|
+
# end
|
29
|
+
# end
|
30
|
+
end
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: voteable_dave_jul
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Dave Huff
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-11 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
13
|
description: A great voting gem.
|
15
14
|
email: David.Huff@computer-critters.com
|
@@ -20,26 +19,25 @@ files:
|
|
20
19
|
- lib/voteable_dave_jul.rb
|
21
20
|
homepage: http://github.com
|
22
21
|
licenses: []
|
22
|
+
metadata: {}
|
23
23
|
post_install_message:
|
24
24
|
rdoc_options: []
|
25
25
|
require_paths:
|
26
26
|
- lib
|
27
27
|
required_ruby_version: !ruby/object:Gem::Requirement
|
28
|
-
none: false
|
29
28
|
requirements:
|
30
|
-
- -
|
29
|
+
- - ">="
|
31
30
|
- !ruby/object:Gem::Version
|
32
31
|
version: '0'
|
33
32
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
33
|
requirements:
|
36
|
-
- -
|
34
|
+
- - ">="
|
37
35
|
- !ruby/object:Gem::Version
|
38
36
|
version: '0'
|
39
37
|
requirements: []
|
40
38
|
rubyforge_project:
|
41
|
-
rubygems_version:
|
39
|
+
rubygems_version: 2.2.2
|
42
40
|
signing_key:
|
43
|
-
specification_version:
|
41
|
+
specification_version: 4
|
44
42
|
summary: A voting gem
|
45
43
|
test_files: []
|