where_chain 0.2.3 → 0.2.4

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: 00b02560557c167de9ce11d97c1d0c9184579c753ca0e8b735d9b1734cc77317
4
- data.tar.gz: 38dd58fcefd3dc9975b984b3742c558f74a59e813fb0f72a6dea6548ddeed0c2
3
+ metadata.gz: e84a8f49bbe5b115ccd2944d65165a2bf95b39fdb8a3baf94ac6b253aa8a9ae5
4
+ data.tar.gz: 141aeac397e0de882c50c613aed825f180bf7972551f3996ba222848c2e39c09
5
5
  SHA512:
6
- metadata.gz: 2e19f7b633157d5a84a43c28b084cf2e2fc29e19d1a61fae14cf6951bf7619f751287099656ebd2b8504e79072a9a405735e1bece3d221d5622ef944a701f80f
7
- data.tar.gz: 5e5b9cb231931d9949126eed5f365d69f6c1c9eccae6b87cc8e05d0a544d24373dd95d4630be5aef9a6a9ea3ef12d24f56dc3be5a7d05d30e1557486bd58a733
6
+ metadata.gz: 73545882586797fd9e2866e6b3dd2dead9519f84fe87214a01d3b842ad85f142cc24cdea1db97782e2f3e3089907911ac47ebb0b000c54b16688bae380a218b2
7
+ data.tar.gz: 47416bde15fb80e7c0cb92bf3e711175aa6b886db8356a33261daf38d8ade9a4a5ff8fdd2d6b11e21b7a89899221f3e267481be108195f8d16fe6c8b074da093
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActiveRecord
2
4
  module QueryMethods
3
5
  class WhereChain
@@ -34,7 +36,7 @@ module ActiveRecord
34
36
  end
35
37
  end
36
38
 
37
- @scope.references!(PredicateBuilder.references(opts)) if Hash === opts
39
+ @scope.references!(PredicateBuilder.references(opts)) if opts.is_a?(Hash)
38
40
  @scope.where_values += where_value
39
41
  @scope
40
42
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActiveRecord
2
4
  # Ruby complains about missing the class if we try to patch it without it
3
5
  class Relation
@@ -21,7 +23,7 @@ module ActiveRecord
21
23
  #
22
24
  # Note: This is the Active Record 5 version.
23
25
  def not(opts = :chain, *rest)
24
- if :chain == opts
26
+ if opts == :chain
25
27
  @invert = true
26
28
  return self
27
29
  end
@@ -30,7 +32,7 @@ module ActiveRecord
30
32
 
31
33
  where_clause = @scope.send(:where_clause_factory).build(opts, rest)
32
34
 
33
- @scope.references!(PredicateBuilder.references(opts)) if Hash === opts
35
+ @scope.references!(PredicateBuilder.references(opts)) if opts.is_a?(Hash)
34
36
  @scope.where_clause += where_clause.invert
35
37
  @scope
36
38
  end
@@ -49,11 +51,11 @@ module ActiveRecord
49
51
 
50
52
  new_predicate = arel_node(node_type, infix, equal_where_clause_predicate)
51
53
  new_where_clause = build_where_clause(new_predicate, equal_where_clause)
52
- if @invert
53
- s.where_clause += new_where_clause.invert
54
- else
55
- s.where_clause += new_where_clause
56
- end
54
+ s.where_clause += if @invert
55
+ new_where_clause.invert
56
+ else
57
+ new_where_clause
58
+ end
57
59
  end
58
60
  end
59
61
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActiveRecord
2
4
  module WhereChainSharedMethods
3
5
  extend ActiveSupport::Concern
@@ -30,7 +32,7 @@ module ActiveRecord
30
32
  def unlike(opts, *rest)
31
33
  prepare_where(Arel::Nodes::DoesNotMatch, nil, opts, rest)
32
34
  end
33
- alias not_like unlike
35
+ alias_method :not_like, :unlike
34
36
 
35
37
  # Returns a new relation expressing a greater than condition in WHERE
36
38
  # according to the conditions in an argument hash
@@ -79,7 +81,7 @@ module ActiveRecord
79
81
  def ensure_proper_attributes(opts)
80
82
  raise ArgumentError, 'This method requires a Hash as an argument.' unless opts.is_a?(Hash)
81
83
 
82
- opts.each_pair do |key, value|
84
+ opts.each_pair do |_key, value|
83
85
  if value.is_a?(Hash) || value.is_a?(Array)
84
86
  raise ArgumentError, 'The value passed to this method should be a valid type.'
85
87
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_record/where_chain_shared_methods'
2
4
 
3
5
  # Active Record changed a lot in Rails 5 and 4 is still supported
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module WhereChain
2
- VERSION = '0.2.3'
4
+ VERSION = '0.2.4'
3
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: where_chain
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcin Ruszkiewicz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-05 00:00:00.000000000 Z
11
+ date: 2019-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: sqlite3
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 1.3.0
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: 1.3.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: pry-rails
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -158,8 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
158
  - !ruby/object:Gem::Version
159
159
  version: '0'
160
160
  requirements: []
161
- rubyforge_project:
162
- rubygems_version: 2.7.6
161
+ rubygems_version: 3.0.1
163
162
  signing_key:
164
163
  specification_version: 4
165
164
  summary: 'WhereChain extensions - Model.where.lt(created_at: Date.today)'