voteable_nsoseka_totals 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/voteable_nsoseka_totals.rb +19 -0
  3. metadata +44 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 219827c919a9eaab3fd73dd544a485f7bbba1f19
4
+ data.tar.gz: 5465ab36312374ceb91e02113ebefd579fdbe874
5
+ SHA512:
6
+ metadata.gz: c3a46ac0c7796d8e0c1b895769ebce539ae2932d7ed108b38433a2e53b5362588b5fbb8db9d6fa37cf8fdd4bbbaf11e044c24d2bd967351d35b41c47c1a087cc
7
+ data.tar.gz: d0ec6b3acf3588fd8c644d0c7610cc8adeae1a6f3c6aeb95b2a70f2133f0de6bbd241c83b2deb927f87d5711f320c48806ebe97a43fc19a6863bf080d29c710b
@@ -0,0 +1,19 @@
1
+ module VoteableNsosekaTotals
2
+ extend ActiveSupport::Concern
3
+
4
+ included do
5
+ has_many :votes, as: :voteable
6
+ end
7
+
8
+ def total_votes
9
+ up_votes - down_votes
10
+ end
11
+
12
+ def up_votes
13
+ self.votes.where(vote: true).size
14
+ end
15
+
16
+ def down_votes
17
+ self.votes.where(vote: false).size
18
+ end
19
+ end
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: voteable_nsoseka_totals
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - nsoseka
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-11-08 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: This gem allows you to easily calculate the total votes, the number of
14
+ up votes and the number of down votes
15
+ email: nsosekaworks@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/voteable_nsoseka_totals.rb
21
+ homepage: http://github.com
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.6.13
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: A voting gem for your apps
44
+ test_files: []