voteable_danyeboah 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_danyeboah.rb +21 -0
- metadata +45 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: b207c5b74ed9053330ee794e1421a158f0a02dde
|
|
4
|
+
data.tar.gz: 480555016de99518fc011701cce50d0ac9b692b1
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 4b6cf784859ac4fdcd910035819b26efabcbef738160c45fd59d649cc62c27757ff7d32397f08ce62b3a4d48fb8bef0a5e43b9cd4fd5d43aef75a594d869264d
|
|
7
|
+
data.tar.gz: 405d65224b4d23fe0bd07158e5cb5fd9fa10aba4f4f683dfa49bd6b626a7464c04aa0410f25f561b6712be2b8070fb74d8332c7168d4ff73c7dec2f1ca1a0fe3
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module Voteable
|
|
2
|
+
extend ActiveSupport::Concern
|
|
3
|
+
|
|
4
|
+
included do
|
|
5
|
+
has_many :votes, as: :voteable
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
# calculate upvotes - downvotes
|
|
9
|
+
def vote_popular
|
|
10
|
+
upvotes - downvotes
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def upvotes
|
|
14
|
+
self.votes.where(vote: true).size
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def downvotes
|
|
18
|
+
self.votes.where(vote: false).size
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: voteable_danyeboah
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Daniel Yeboah-Kordieh
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2014-01-01 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: this is my first gem. A simple module I wrote to allow voting on comments
|
|
14
|
+
and posts
|
|
15
|
+
email: danyeboah@gmail.com
|
|
16
|
+
executables: []
|
|
17
|
+
extensions: []
|
|
18
|
+
extra_rdoc_files: []
|
|
19
|
+
files:
|
|
20
|
+
- lib/Voteable_danyeboah.rb
|
|
21
|
+
homepage: https://www.github.com/danyeboah
|
|
22
|
+
licenses: []
|
|
23
|
+
metadata: {}
|
|
24
|
+
post_install_message:
|
|
25
|
+
rdoc_options: []
|
|
26
|
+
require_paths:
|
|
27
|
+
- lib
|
|
28
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '0'
|
|
33
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
34
|
+
requirements:
|
|
35
|
+
- - ">="
|
|
36
|
+
- !ruby/object:Gem::Version
|
|
37
|
+
version: '0'
|
|
38
|
+
requirements: []
|
|
39
|
+
rubyforge_project:
|
|
40
|
+
rubygems_version: 2.4.6
|
|
41
|
+
signing_key:
|
|
42
|
+
specification_version: 4
|
|
43
|
+
summary: gem for voting on comments/posts
|
|
44
|
+
test_files: []
|
|
45
|
+
has_rdoc:
|