scoping 0.0.1 → 0.0.2
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/scoping/scope_composer.rb +12 -1
- data/lib/scoping/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: 8a12f75d29a3d3175dabf4cd22e60a501b8fcdeb
|
4
|
+
data.tar.gz: 870c0de94b116be0d1cbc882b5b6b12ea5ac55ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d27e42762598157e5002d62248eac4a4bbba55b0574cc58da305da65333ff10f17fc3cf438049e5ef8bcf62a13d0d17c2a6d18512458ff09c40710ada0fa4df
|
7
|
+
data.tar.gz: 82f55e9a93ce200809f5abaad89c6e877ee362abe0a9fd71d84beab1c07c889d80b4714c097b85af5dd444006ce99f38262ed0c4bd23e0d79fc2081bbdc04e5f
|
@@ -111,7 +111,7 @@ module Scoping
|
|
111
111
|
# @param [String] field
|
112
112
|
# @param [Object] value
|
113
113
|
def apply_field_on_current_scope(field, value)
|
114
|
-
arity =
|
114
|
+
arity = arity_for(field)
|
115
115
|
if arity == 0
|
116
116
|
if value == "1" || value == true
|
117
117
|
@current_scope = @current_scope.public_send field
|
@@ -121,6 +121,17 @@ module Scoping
|
|
121
121
|
end
|
122
122
|
end
|
123
123
|
|
124
|
+
# Returns arity for given scope.
|
125
|
+
#
|
126
|
+
# @return [Fixnum]
|
127
|
+
def arity_for(scope)
|
128
|
+
if @base_scope.respond_to?(:klass)
|
129
|
+
@base_scope.klass
|
130
|
+
else
|
131
|
+
@base_scope
|
132
|
+
end.method(field).arity
|
133
|
+
end
|
134
|
+
|
124
135
|
# Return the filter fields.
|
125
136
|
#
|
126
137
|
# @return [Array]
|
data/lib/scoping/version.rb
CHANGED