voteable_xtian 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.
Files changed (3) hide show
  1. checksums.yaml +15 -0
  2. data/lib/voteable_xtian.rb +20 -0
  3. metadata +44 -0
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ YTM3MTE5MjU4YTBhYWFlNjU2NGM0MzgzZjU2NWY0ZTA0ZjEyODM1NA==
5
+ data.tar.gz: !binary |-
6
+ OTk5ZTc5MTY3OWZmMWUwNDczODZiN2I1ZjAyZmZhMGJhZmNmZDI1MQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ MTcxMWYwZjVlNTczODhiZDk0MDFjODU3OTlkYzc2NjI3NTc3YzU3NWJjNjgw
10
+ MGRhMWJmZmY5NTBlNzIxNDg2YTNmOGVhNWUxMDMyNDU0ZmE5ZjhkY2VmODEy
11
+ NzFkNzdmNjE2N2E5ZWVjNzc3MmQ5ZTU3YzcxYTEzOWU2Y2UwMmY=
12
+ data.tar.gz: !binary |-
13
+ YjM5ODkyZmJiN2JhODRiZjg1ZDkzNzE1ZTY3OTNkYmJmNGY1OGRmZmQwODA5
14
+ NjM4MmM5MTllMjQ3ZWYyN2U4OWI4NTI5OWQ0NzI5MmZkNDhkNTgyNTY0N2Zh
15
+ N2Y1NmRmN2M1ZDdmY2UyN2IzMTUxYmJjNmVlMTQ0ZjgxMmZmYWI=
@@ -0,0 +1,20 @@
1
+ module Voteable
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
+
20
+ end
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: voteable_xtian
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Christian Amadasun
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-05-03 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: The best voting gem ever made by Xtian
14
+ email:
15
+ - amadasun@nomail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/voteable_xtian.rb
21
+ homepage: https://github.com/Osaboy/Voteable-Gem
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.2.2
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: A voting gem
44
+ test_files: []