voteable_ant 0.0.3
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_ant.rb +19 -0
- metadata +46 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 02c2023f1bf1671fc20fe4ac149d231808b3d43d
|
|
4
|
+
data.tar.gz: 5b1a0a75085f67d5fc5ae7454b847a930850d0b2
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: f1c2951bb25e7901ca956379ce83785a701e2ab73f3ebe8f7780c49351e703f3bebfc9c61edcc43e5077313b8080f3b08c6bc9592bd3e18c0a83f3bcadb9fb67
|
|
7
|
+
data.tar.gz: a7adaeb4af114cf39110451db1f68e4af79fb8834f0a8ce98aea65bf6ea4a81d60d1ac1be13f1c9e8b3e8fbaa4699ec8e08bcd16e40dc0e8e7017d12475e8106
|
data/lib/voteable_ant.rb
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module VoteableAnt
|
|
2
|
+
extend ActiveSupport::Concern
|
|
3
|
+
|
|
4
|
+
included do
|
|
5
|
+
has_many :votes, as: :voteable
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def votes_count
|
|
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,46 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: voteable_ant
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.3
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Anton Malkov
|
|
8
|
+
- Tealeaf Academy
|
|
9
|
+
autorequire:
|
|
10
|
+
bindir: bin
|
|
11
|
+
cert_chain: []
|
|
12
|
+
date: 2015-11-22 00:00:00.000000000 Z
|
|
13
|
+
dependencies: []
|
|
14
|
+
description: Votable gem created as part of Tealeaf Academy Course for the PostIt
|
|
15
|
+
app.
|
|
16
|
+
email: anton.malkov@gmail.com
|
|
17
|
+
executables: []
|
|
18
|
+
extensions: []
|
|
19
|
+
extra_rdoc_files: []
|
|
20
|
+
files:
|
|
21
|
+
- lib/voteable_ant.rb
|
|
22
|
+
homepage: http://github.com/antonmal/votable_ant
|
|
23
|
+
licenses: []
|
|
24
|
+
metadata: {}
|
|
25
|
+
post_install_message:
|
|
26
|
+
rdoc_options: []
|
|
27
|
+
require_paths:
|
|
28
|
+
- lib
|
|
29
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
35
|
+
requirements:
|
|
36
|
+
- - ">="
|
|
37
|
+
- !ruby/object:Gem::Version
|
|
38
|
+
version: '0'
|
|
39
|
+
requirements: []
|
|
40
|
+
rubyforge_project:
|
|
41
|
+
rubygems_version: 2.4.6
|
|
42
|
+
signing_key:
|
|
43
|
+
specification_version: 4
|
|
44
|
+
summary: Add voting capabilities to your models.
|
|
45
|
+
test_files: []
|
|
46
|
+
has_rdoc:
|