scopie 1.0.6 → 1.1.0
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/README.md +1 -1
- data/lib/scopie/base.rb +6 -4
- data/lib/scopie/value.rb +4 -0
- 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: 8bee02f08df53a4ada09a728fbba17acddc3edab
|
4
|
+
data.tar.gz: d57901f26a3758979ac6da8b0e2d16c6752df7c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4420ad199466801d4af7f85b639c448d97231b2e0d86b4c445930a30a8a2ee8ed2a6c9efc56019cfe36778a33b233aa7f3c04dfdd40f0a0c702605b1a07f2018
|
7
|
+
data.tar.gz: 19cbd4bb3c08a6e9ea0723424658870ba8060838bb239c2de9f0dd217c0cdd370ace7c2958e56944b3e10637893495213a6ece618b7fb62d936ff75c48e713a7
|
data/README.md
CHANGED
@@ -147,6 +147,6 @@ Scopie supports several options:
|
|
147
147
|
|
148
148
|
## Thanks
|
149
149
|
|
150
|
-
Scopie was inspired by [has_scope](http://github.com/plataformatec/has_scope) and [pundit](http://github.com/elabs/
|
150
|
+
Scopie was inspired by [has_scope](http://github.com/plataformatec/has_scope) and [pundit](http://github.com/elabs/pundit).
|
151
151
|
|
152
152
|
Thanks to both.
|
data/lib/scopie/base.rb
CHANGED
@@ -69,7 +69,7 @@ class Scopie::Base
|
|
69
69
|
value = scope_value(scope_name, options, hash)
|
70
70
|
next unless scope_applicable?(value, options, method)
|
71
71
|
|
72
|
-
[scope_name, value
|
72
|
+
[scope_name, value]
|
73
73
|
end
|
74
74
|
|
75
75
|
scopes.compact!
|
@@ -80,9 +80,11 @@ class Scopie::Base
|
|
80
80
|
|
81
81
|
def apply_scope(scope_name, target, value, hash)
|
82
82
|
result = if respond_to?(scope_name)
|
83
|
-
public_send(scope_name, target, value, hash)
|
83
|
+
public_send(scope_name, target, value.coerced, hash)
|
84
84
|
else
|
85
|
-
|
85
|
+
args = [scope_name]
|
86
|
+
args << value.coerced if value.present? || value.allow_blank?
|
87
|
+
target.public_send(*args)
|
86
88
|
end
|
87
89
|
|
88
90
|
if Scopie::RESULTS_TO_IGNORE.include?(result)
|
@@ -109,7 +111,7 @@ class Scopie::Base
|
|
109
111
|
return false unless method_applicable?(method, options)
|
110
112
|
return false unless value.given?
|
111
113
|
|
112
|
-
|
114
|
+
true
|
113
115
|
end
|
114
116
|
|
115
117
|
def reduced_hash(hash, options)
|
data/lib/scopie/value.rb
CHANGED
data/lib/scopie/version.rb
CHANGED