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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e84a8f49bbe5b115ccd2944d65165a2bf95b39fdb8a3baf94ac6b253aa8a9ae5
|
4
|
+
data.tar.gz: 141aeac397e0de882c50c613aed825f180bf7972551f3996ba222848c2e39c09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
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
|
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
|
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
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
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
|
-
|
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 |
|
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
|
data/lib/where_chain.rb
CHANGED
data/lib/where_chain/version.rb
CHANGED
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.
|
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:
|
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:
|
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:
|
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
|
-
|
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)'
|