voteable_shankar_oct2014 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/voteable_shankar_oct.rb +20 -0
- metadata +43 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 053184a865693931779f1727cd87d8e010ca0912
|
4
|
+
data.tar.gz: 5df44455f50967cc9b9612c7006c18c28c34c865
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8105caa0825803b16b05a85099b88c3c87289844b02d6eecbb1917ff009ba8836f41e976c19d5996ce651e570f4010713da110ef785923a220a771bd4a0e43f3
|
7
|
+
data.tar.gz: 5e6092be11c82ec10be8756b1e8e1b28b6cd2f0fead52a5f1b2c03605d4ee7379f32dae5d43dbc58cda1b24ca1fa191e9cc699598bd774c77d3ef3618b3c3ca7
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module VoteableShankarOct
|
2
|
+
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
has_many :votes, as: :voteable
|
7
|
+
end
|
8
|
+
|
9
|
+
def total_votes
|
10
|
+
self.up_votes - self.down_votes
|
11
|
+
end
|
12
|
+
|
13
|
+
def up_votes
|
14
|
+
self.votes.where(vote: true).size
|
15
|
+
end
|
16
|
+
|
17
|
+
def down_votes
|
18
|
+
self.votes.where(vote: false).size
|
19
|
+
end
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: voteable_shankar_oct2014
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Shankar Narayan
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-10-08 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: The best voting gem for beginers
|
14
|
+
email: shankar@kargoo.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/voteable_shankar_oct.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: A voting gem
|
43
|
+
test_files: []
|