scopie 1.1.0 → 1.1.1
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 +4 -4
- data/lib/scopie/base.rb +10 -3
- data/lib/scopie/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8624fb23637f827341df103cd643fdb673b72243
|
4
|
+
data.tar.gz: 2d5ee0f01a32c144a1cbe999953d014a9c284181
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c68743f9a944c1ca51ee5d84aafa5b6da7468cab63560a9e0956f6cb91df2687c721bfedf73ebde4cd4c2bad3a35083299cc31ea1920e4585c19c143ae8fbe0
|
7
|
+
data.tar.gz: e9c308c5a4646ec94437587dd97063ec6d8b512ab709728da6bd40dbacff63185d350abbbb335d5528d9d6ab556dedaf65f3735d524f065b1edc00abae9c46dd
|
data/lib/scopie/base.rb
CHANGED
@@ -57,7 +57,7 @@ class Scopie::Base
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def apply_scopes(target, hash, method = nil)
|
60
|
-
|
60
|
+
current_scopes_values(hash, method).each do |scope_name, value|
|
61
61
|
target = apply_scope(scope_name, target, value, hash)
|
62
62
|
end
|
63
63
|
|
@@ -65,6 +65,15 @@ class Scopie::Base
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def current_scopes(hash, method = nil)
|
68
|
+
hsh = current_scopes_values(hash, method)
|
69
|
+
hsh.update(hsh) do |_, value|
|
70
|
+
value.coerced
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
private
|
75
|
+
|
76
|
+
def current_scopes_values(hash, method)
|
68
77
|
scopes = scopes_configuration.map do |scope_name, options|
|
69
78
|
value = scope_value(scope_name, options, hash)
|
70
79
|
next unless scope_applicable?(value, options, method)
|
@@ -76,8 +85,6 @@ class Scopie::Base
|
|
76
85
|
scopes.to_h
|
77
86
|
end
|
78
87
|
|
79
|
-
private
|
80
|
-
|
81
88
|
def apply_scope(scope_name, target, value, hash)
|
82
89
|
result = if respond_to?(scope_name)
|
83
90
|
public_send(scope_name, target, value.coerced, hash)
|
data/lib/scopie/version.rb
CHANGED