sinatra-has_scope 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.
@@ -78,20 +78,22 @@ module Sinatra
78
78
  def apply_scopes(scope_group, target, hash)
79
79
  return target unless scopes_configuration
80
80
 
81
- self.scopes_configuration[scope_group].each do |scope, options|
82
- key = options[:as].to_s
83
-
84
- if hash.key?(key)
85
- value, call_scope = hash[key], true
86
- elsif options.key?(:default)
87
- value, call_scope = options[:default], true
88
- value = value.call(self) if value.is_a?(Proc)
89
- end
90
-
91
- value = parse_value(options[:type], key, value)
92
-
93
- if call_scope && (value.present? || options[:allow_blank])
94
- target = call_scope_by_type(options[:type], scope, target, value, options)
81
+ if self.scopes_configuration.key?(scope_group)
82
+ self.scopes_configuration[scope_group].each do |scope, options|
83
+ key = options[:as].to_s
84
+
85
+ if hash.key?(key)
86
+ value, call_scope = hash[key], true
87
+ elsif options.key?(:default)
88
+ value, call_scope = options[:default], true
89
+ value = value.call(self) if value.is_a?(Proc)
90
+ end
91
+
92
+ value = parse_value(options[:type], key, value)
93
+
94
+ if call_scope && (value.present? || options[:allow_blank])
95
+ target = call_scope_by_type(options[:type], scope, target, value, options)
96
+ end
95
97
  end
96
98
  end
97
99
 
@@ -1,5 +1,5 @@
1
1
  module Sinatra
2
2
  module HasScope
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-has_scope
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Simon COURTOIS