voteable_riggs 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_riggs.rb +17 -0
- metadata +45 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: b8a63f75eab417b8732d6f4beff53460bb10f9dc
|
|
4
|
+
data.tar.gz: f7118d3e5e555add3948b2e2f32eae72f46e1875
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: dcc59e7d28b5b347b8658a1c91ee610201d0ab482d795f81f651a4cc877669e1f74ac898afde398a5f4e5f2a8ec76cf90d771f861a54aac113de4a4615cceac0
|
|
7
|
+
data.tar.gz: 3198b100d582e881030a91af780135cc0ed9ec72960db89acad208b060a8101a956c151a1b28d3e0fdb00cbb812d8ba360df6ec08dd3df4acf6d38e0b5778d3b
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module Voteable
|
|
2
|
+
extend ActiveSupport::Concern
|
|
3
|
+
|
|
4
|
+
included { has_many :votes, as: :voteable }
|
|
5
|
+
|
|
6
|
+
def upvotes
|
|
7
|
+
self.votes.where(vote: true).size
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def downvotes
|
|
11
|
+
self.votes.where(vote: false).size
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def net_votes
|
|
15
|
+
upvotes - downvotes
|
|
16
|
+
end
|
|
17
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: voteable_riggs
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Aaron Riggs
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2015-10-02 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: |-
|
|
14
|
+
Note: You will need to set up a vote model, so that you can associate votes to your asset.\
|
|
15
|
+
This simple module will add a has_many :votes association into any model declaration from which include Voteable is called. It will also inject 3 instance methods that you should consider using when making a way to vote, and retrieve a tally of votes.
|
|
16
|
+
email: riggs.aaron@gmail.com
|
|
17
|
+
executables: []
|
|
18
|
+
extensions: []
|
|
19
|
+
extra_rdoc_files: []
|
|
20
|
+
files:
|
|
21
|
+
- lib/voteable_riggs.rb
|
|
22
|
+
homepage: http://google.com
|
|
23
|
+
licenses: []
|
|
24
|
+
metadata: {}
|
|
25
|
+
post_install_message:
|
|
26
|
+
rdoc_options: []
|
|
27
|
+
require_paths:
|
|
28
|
+
- lib
|
|
29
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
35
|
+
requirements:
|
|
36
|
+
- - ">="
|
|
37
|
+
- !ruby/object:Gem::Version
|
|
38
|
+
version: '0'
|
|
39
|
+
requirements: []
|
|
40
|
+
rubyforge_project:
|
|
41
|
+
rubygems_version: 2.4.3
|
|
42
|
+
signing_key:
|
|
43
|
+
specification_version: 4
|
|
44
|
+
summary: Gem for adding basic voting to an existing feature.
|
|
45
|
+
test_files: []
|