voteable-eworx 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/voteable-eworx.rb +22 -0
- metadata +44 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: cefc8ec25e03d72789a18a68b1859a97a8081566
|
4
|
+
data.tar.gz: c662ab774da9c4eea85c27c05813e5c7bc801d27
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 532b68951d43913871c111b53e1145312682f9baae9a80f26ab598c958e74438bf6840c580a041dba2ac95a55fbd60d33cf5d6619e8c4c235f6a509cbcd9c086
|
7
|
+
data.tar.gz: eb2475e28707c8fac5a0d6f8aeb15480b752bd37739e258feb83a75134695c23157dfb1ca90b427d8f5f66004c178327d6f94b669a09d96941775b9a784e9b4a
|
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
module Voteable
|
3
|
+
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
has_many :votes, as: :voteable
|
8
|
+
end
|
9
|
+
|
10
|
+
def up_votes
|
11
|
+
self.votes.where(vote: true).size
|
12
|
+
end
|
13
|
+
|
14
|
+
def down_votes
|
15
|
+
self.votes.where(vote: false).size
|
16
|
+
end
|
17
|
+
|
18
|
+
def total_votes
|
19
|
+
self.up_votes - self.down_votes
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: voteable-eworx
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- A Atwal
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-07-20 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Supports voting with a Votes DB Table as a Voteable Polymorphic table
|
14
|
+
email: asatwal01@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/voteable-eworx.rb
|
20
|
+
homepage: http://www.e-worx.co.uk
|
21
|
+
licenses:
|
22
|
+
- GNU
|
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.2.2
|
41
|
+
signing_key:
|
42
|
+
specification_version: 4
|
43
|
+
summary: Voteable GEM
|
44
|
+
test_files: []
|