voteable_willem 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_willem.rb +21 -0
- metadata +43 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: a986e32d1928fbc412a3f20d953f25b0821e64d1
|
|
4
|
+
data.tar.gz: 22d8b06619ec716074eafeb589051d84f417e432
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 3359635373cc0b256e55233781a703eae6eb3bb472343756f97542764e4cb3a1f1b93a564d5e160b2065a0d72030507862871c8268534a32716219e611abd7c0
|
|
7
|
+
data.tar.gz: 9577ea5aed5d60ace7a0e99b30c2ef4ff58bccc41230a5f5160669284110e23ace1f94e9322cba360efa6520bab12fd44e286d9f98a8914ec08d741f1786384e
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Using Concerns
|
|
2
|
+
|
|
3
|
+
module Voteable
|
|
4
|
+
extend ActiveSupport::Concern
|
|
5
|
+
|
|
6
|
+
included do
|
|
7
|
+
has_many :votes, as: :voteable
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def total_votes
|
|
11
|
+
self.upvote - self.downvote
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def upvote
|
|
15
|
+
self.votes.where(vote: true).size
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def downvote
|
|
19
|
+
self.votes.where(vote: false).size
|
|
20
|
+
end
|
|
21
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: voteable_willem
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Willem T
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2015-11-29 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: 'A voting gem, to up/down vote posts and comments ''reddit''style '
|
|
14
|
+
email: willemtoledano@gmail.com
|
|
15
|
+
executables: []
|
|
16
|
+
extensions: []
|
|
17
|
+
extra_rdoc_files: []
|
|
18
|
+
files:
|
|
19
|
+
- lib/voteable_willem.rb
|
|
20
|
+
homepage: https://github.com/willemtoledano
|
|
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.5
|
|
40
|
+
signing_key:
|
|
41
|
+
specification_version: 4
|
|
42
|
+
summary: A voting gem
|
|
43
|
+
test_files: []
|