voteable_matt_march 0.0.0
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_matt_march.rb +20 -0
- metadata +43 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bf3af8c5ae9f97ab25b022c15eabbea9cf2b574b
|
4
|
+
data.tar.gz: b5f243ae95a326d68c125374dcadf6e42e241dbc
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 98f48106473ba989089520d9ec4ce9aedb665da93554815c0b9cf2ad67ee9e6bde9680b71d933066dd6f37c9b4c8e39b656fd94df961ecdc9a43929b1931a780
|
7
|
+
data.tar.gz: 0ca5587914c5cc803e546e71efe28886b5db4a508d8a411e947e547069402cfd10004151521e397d64340d20ef02692cb6f75c8cf91f822721332b35162a2314
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module VoteableMattMarch
|
2
|
+
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
has_many :votes, as: :voteable
|
7
|
+
end
|
8
|
+
|
9
|
+
def up_vote
|
10
|
+
self.votes.where(vote: true).size
|
11
|
+
end
|
12
|
+
|
13
|
+
def down_vote
|
14
|
+
self.votes.where(vote: false).size
|
15
|
+
end
|
16
|
+
|
17
|
+
def total_votes
|
18
|
+
self.up_vote - self.down_vote
|
19
|
+
end
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: voteable_matt_march
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Matt Ensor
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-03-24 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: The best voting gem ever!
|
14
|
+
email: mattyensor@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/voteable_matt_march.rb
|
20
|
+
homepage: http://github.com
|
21
|
+
licenses: []
|
22
|
+
metadata: {}
|
23
|
+
post_install_message:
|
24
|
+
rdoc_options: []
|
25
|
+
require_paths:
|
26
|
+
- lib
|
27
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - ">="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: '0'
|
32
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0'
|
37
|
+
requirements: []
|
38
|
+
rubyforge_project:
|
39
|
+
rubygems_version: 2.2.2
|
40
|
+
signing_key:
|
41
|
+
specification_version: 4
|
42
|
+
summary: This is a real cool voting gem
|
43
|
+
test_files: []
|