acts_as_favoritor 5.0.3 → 6.0.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: c785314efa34b1f88cfee3d6c39acef924fb989e6a2654c65241a07facd707b0
4
- data.tar.gz: 28dfbd0a05eab1723e871df1aec6657aabae38875402f03f5f2347ccedb7bc22
3
+ metadata.gz: 720e4ea66b88a043a1bcd46c702dc8aa445b20fe60517e978791d8c4bcbc90af
4
+ data.tar.gz: beb07b7607a369e302816b9e39b9dae5ec8ca488ff717ff3bdb3e3b96fea1227
5
5
  SHA512:
6
- metadata.gz: af2a517dc943fa69ea7d5442beced5d086a31a9586e1587fecf4ae3c0ad57ab9579099731ec5d92e794075b3d804e0facf7605fa196cdb3531edfb1f4d9855d0
7
- data.tar.gz: 5e19c65f8f122686cf452f3690f18856e0e235d443e0772c8e4c4468d1b43bea2a46653e495f68d18dc0591ac6e725c2f53f8e3de7cbc5f6ddc0c2b89b9664a4
6
+ metadata.gz: f1dc068b8f318a7141d2d695693245aef8aaf22ffecc2cb46484308fb9c0563cd1576d855113f336871cb4a6e7a20adf867c5b0629f7a04042fbd5862615a746
7
+ data.tar.gz: b736fbaa9e300ac44c9f83cbe99f780e8cfabcde661a9baf7bbef8a7fa88a28c61a022e8140d005269315b84524d8a69a549fa699da3a513221511613da28800
data/README.md CHANGED
@@ -147,7 +147,7 @@ Using scopes with `acts_as_favoritor` enables you to Follow, Watch, Favorite, [.
147
147
 
148
148
  By default all of your favorites are scoped to `'favorite'`.
149
149
 
150
- You can create new scopes on the fly. Every single method takes `scope`/`scopes` as an option which expexts a symbol or an array of symbols containing your scopes.
150
+ You can create new scopes on the fly. Every single method takes `scope`/`scopes` as an option which expects a symbol or an array of symbols containing your scopes.
151
151
 
152
152
  So lets see how this works:
153
153
 
@@ -63,7 +63,7 @@ module ActsAsFavoritor
63
63
  scopes: nil)
64
64
  self.class.build_result_for_scopes(scopes || scope) do |s|
65
65
  favorite_record = get_favorite(favoritable, s)
66
- return nil unless favorite_record.present?
66
+ return nil if favorite_record.blank?
67
67
 
68
68
  result = favorite_record.destroy!
69
69
  dec_cache(favoritable, s) if ActsAsFavoritor.configuration.cache && result.destroyed?
@@ -2,11 +2,11 @@
2
2
 
3
3
  module ActsAsFavoritor
4
4
  module FavoritorLib
5
- def build_result_for_scopes(scopes)
5
+ def build_result_for_scopes(scopes, &block)
6
6
  return yield(scopes) unless scopes.is_a?(Array)
7
7
  return if scopes.empty?
8
8
 
9
- sanitized_scopes(scopes).map { |scope| [scope, yield(scope)] }.to_h
9
+ sanitized_scopes(scopes).index_with(&block)
10
10
  end
11
11
 
12
12
  private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActsAsFavoritor
4
- VERSION = '5.0.3'
4
+ VERSION = '6.0.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_favoritor
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.3
4
+ version: 6.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Hübotter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-16 00:00:00.000000000 Z
11
+ date: 2022-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop-rails
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: rubocop-rspec
99
113
  requirement: !ruby/object:Gem::Requirement
@@ -159,14 +173,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
159
173
  requirements:
160
174
  - - ">="
161
175
  - !ruby/object:Gem::Version
162
- version: '2.5'
176
+ version: '2.7'
163
177
  required_rubygems_version: !ruby/object:Gem::Requirement
164
178
  requirements:
165
179
  - - ">="
166
180
  - !ruby/object:Gem::Version
167
181
  version: '0'
168
182
  requirements: []
169
- rubygems_version: 3.2.22
183
+ rubygems_version: 3.3.7
170
184
  signing_key:
171
185
  specification_version: 4
172
186
  summary: A Rubygem to add Favorite, Follow, Vote, etc. functionality to ActiveRecord