acts_as_votable 0.13.2 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6493d9c06d86a52dc314e405d87f1cb571d5af56d5e2a0b143e700f864d2ba24
4
- data.tar.gz: e832c7530a935db303318540558b8de0c7992e6be33c31efc6dd69fecdd56092
3
+ metadata.gz: 716790eb29b78931fcc52052c68a260036354513ee02850f06fc4460812b2b0a
4
+ data.tar.gz: 06e8af46b169792a3f218666ef9ee73d41e781baae2c88a5ed0202aa151d9043
5
5
  SHA512:
6
- metadata.gz: 5ba57359f7c30c08272f97a5c066a8b0f9ec8eb01c12966abf589a7d005542910a3b7fb3162bdd7eb3924f38bd081bafb174e73038a107448d7c1da7c7b1299b
7
- data.tar.gz: f63bc1fbca5eb2fca9bd8a9182eb9ae669975f01edaa2e6beb0cc82399ff26ccb18e89c71e4659eea2a29532f6003d8c48748b1ea4be1f88fad3de5e7f3e978b
6
+ metadata.gz: 476384079c94b60160d19ececbc96aedd83a0b4cadbc7b17662cf630cd2cbcfaaed9c616a74a3e5e10a93c0ec692437628fe967c8712d1e39ee8282b3b210dc5
7
+ data.tar.gz: 84989f2e628bfb60a07e07696a903b383cc07f372ac9780c597dc56d7d64721f98fbf20d1d4f44106fc77463d9e52713254d624df5bea2da378ff76f66a7d633
@@ -25,6 +25,15 @@ jobs:
25
25
  - gemfiles/rails_6_1.gemfile
26
26
  continue-on-error:
27
27
  - false
28
+ include:
29
+ - ruby: "3.0"
30
+ gemfile: gemfiles/rails_6_1.gemfile
31
+ os: ubuntu
32
+ continue-on-error: false
33
+ - ruby: 3.1
34
+ gemfile: gemfiles/rails_7_0.gemfile
35
+ os: ubuntu
36
+ continue-on-error: false
28
37
 
29
38
  env:
30
39
  BUNDLE_GEMFILE: "${{ matrix.gemfile }}"
@@ -41,4 +50,4 @@ jobs:
41
50
  - name: Test
42
51
  run: bundle exec rake spec
43
52
 
44
- # use this
53
+ # use this
data/Appraisals CHANGED
@@ -16,4 +16,9 @@ end
16
16
  appraise "rails-6-1" do
17
17
  gem "rails", "6.1.0"
18
18
  gem "sqlite3", "~> 1.4"
19
- end
19
+ end
20
+
21
+ appraise "rails-7-0" do
22
+ gem "rails", "~> 7.0.0"
23
+ gem "sqlite3", "~> 1.4"
24
+ end
data/README.md CHANGED
@@ -95,12 +95,12 @@ Revisiting the previous example of code.
95
95
 
96
96
  # tally them up!
97
97
  @post.votes_for.size # => 5
98
- @post.weighted_total => 5
98
+ @post.weighted_total # => 5
99
99
  @post.get_likes.size # => 3
100
100
  @post.get_upvotes.size # => 3
101
101
  @post.get_dislikes.size # => 2
102
102
  @post.get_downvotes.size # => 2
103
- @post.weighted_score => 1
103
+ @post.weighted_score # => 1
104
104
  ```
105
105
 
106
106
  Active Record scopes are provided to make life easier.
@@ -342,6 +342,9 @@ class AddCachedVotesToPosts < ActiveRecord::Migration
342
342
  t.integer :cached_weighted_subscribe_score, default: 0
343
343
  t.integer :cached_weighted_subscribe_total, default: 0
344
344
  t.float :cached_weighted_subscribe_average, default: 0.0
345
+
346
+ # Uncomment this line to force caching of existing scoped votes
347
+ # Post.find_each { |p| p.update_cached_votes("subscribe") }
345
348
  end
346
349
  end
347
350
  end
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "~> 7.0.0"
6
+ gem "sqlite3", "~> 1.4"
7
+
8
+ gemspec path: "../"
@@ -10,7 +10,6 @@ module ActsAsVotable
10
10
  end
11
11
 
12
12
  def acts_as_votable(args = {})
13
- require "acts_as_votable/votable"
14
13
  include ActsAsVotable::Votable
15
14
 
16
15
  if args.key?(:cacheable_strategy) && !ALLOWED_CACHEABLE_STRATEGIES.include?(args[:cacheable_strategy])
@@ -8,7 +8,6 @@ module ActsAsVotable
8
8
  end
9
9
 
10
10
  def acts_as_voter(*_args)
11
- require "acts_as_votable/voter"
12
11
  include ActsAsVotable::Voter
13
12
 
14
13
  class_eval do
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActsAsVotable
4
+ module Extenders
5
+ extend ActiveSupport::Autoload
6
+
7
+ autoload :"Votable"
8
+ autoload :"Voter"
9
+ autoload :"Controller"
10
+ end
11
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActsAsVotable
4
+ module Helpers
5
+ extend ActiveSupport::Autoload
6
+
7
+ autoload :"Words"
8
+ end
9
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActsAsVotable
4
- VERSION = "0.13.2"
4
+ VERSION = "0.14.0"
5
5
  end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "acts_as_votable/helpers/words"
4
- require "acts_as_votable/cacheable"
5
4
 
6
5
  module ActsAsVotable
7
6
  module Votable
@@ -2,20 +2,26 @@
2
2
 
3
3
  require "active_record"
4
4
  require "active_support/inflector"
5
+ require "active_support/dependencies/autoload"
5
6
 
6
7
  $LOAD_PATH.unshift(File.dirname(__FILE__))
7
8
 
8
9
  module ActsAsVotable
10
+ extend ActiveSupport::Autoload
11
+
12
+ autoload :Votable
13
+ autoload :Vote
14
+ autoload :Voter
15
+ autoload :Cacheable
16
+ autoload :Extenders
17
+ autoload :Helpers
18
+
9
19
  if defined?(ActiveRecord::Base)
10
- require "acts_as_votable/extenders/votable"
11
- require "acts_as_votable/extenders/voter"
12
- require "acts_as_votable/vote"
13
20
  ActiveRecord::Base.extend ActsAsVotable::Extenders::Votable
14
21
  ActiveRecord::Base.extend ActsAsVotable::Extenders::Voter
15
22
  end
16
23
  end
17
24
 
18
- require "acts_as_votable/extenders/controller"
19
25
  ActiveSupport.on_load(:action_controller) do
20
26
  include ActsAsVotable::Extenders::Controller
21
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_votable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.2
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-08 00:00:00.000000000 Z
11
+ date: 2022-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -118,11 +118,14 @@ files:
118
118
  - gemfiles/rails_6.gemfile
119
119
  - gemfiles/rails_6_1.gemfile
120
120
  - gemfiles/rails_6_rc1.gemfile
121
+ - gemfiles/rails_7_0.gemfile
121
122
  - lib/acts_as_votable.rb
122
123
  - lib/acts_as_votable/cacheable.rb
124
+ - lib/acts_as_votable/extenders.rb
123
125
  - lib/acts_as_votable/extenders/controller.rb
124
126
  - lib/acts_as_votable/extenders/votable.rb
125
127
  - lib/acts_as_votable/extenders/voter.rb
128
+ - lib/acts_as_votable/helpers.rb
126
129
  - lib/acts_as_votable/helpers/words.rb
127
130
  - lib/acts_as_votable/version.rb
128
131
  - lib/acts_as_votable/votable.rb
@@ -152,7 +155,7 @@ homepage: http://rubygems.org/gems/acts_as_votable
152
155
  licenses:
153
156
  - MIT
154
157
  metadata: {}
155
- post_install_message:
158
+ post_install_message:
156
159
  rdoc_options: []
157
160
  require_paths:
158
161
  - lib
@@ -167,8 +170,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
170
  - !ruby/object:Gem::Version
168
171
  version: '0'
169
172
  requirements: []
170
- rubygems_version: 3.2.2
171
- signing_key:
173
+ rubyforge_project:
174
+ rubygems_version: 2.7.6
175
+ signing_key:
172
176
  specification_version: 4
173
177
  summary: Rails gem to allowing records to be votable
174
178
  test_files: