interpol 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -19,6 +19,10 @@ if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ruby' # MRI only
19
19
  cane.abc_exclude = %w[
20
20
  Interpol::Configuration#register_default_callbacks
21
21
  ]
22
+
23
+ cane.style_exclude = %w[
24
+ spec/unit/interpol/sinatra/request_params_parser_spec.rb
25
+ ]
22
26
  end
23
27
  else
24
28
  task(:quality) { } # no-op
@@ -89,12 +89,23 @@ module Interpol
89
89
  # We cannot access the full params (w/ path params) in a before hook,
90
90
  # due to the order that sinatra runs the hooks in relation to route
91
91
  # matching.
92
- def process_route(*method_args)
92
+ def process_route(*method_args, &block)
93
+ return super unless SinatraOverriddes.being_processed_by_sinatra?(block)
94
+
93
95
  super do |*block_args|
94
96
  validate_params if settings.parse_params?
95
97
  yield *block_args
96
98
  end
97
99
  end
100
+
101
+ def self.being_processed_by_sinatra?(block)
102
+ # In case the block is nil or we're on 1.8 w/o #source_location...
103
+ # Just assume the route is being processed by sinatra.
104
+ # It's an exceptional case for it to not be (e.g. NewRelic's
105
+ # Sinatra hook).
106
+ return true unless block.respond_to?(:source_location)
107
+ block.source_location.first.end_with?('sinatra/base.rb')
108
+ end
98
109
  end
99
110
  end
100
111
  end
@@ -1,3 +1,3 @@
1
1
  module Interpol
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: interpol
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-24 00:00:00.000000000 Z
12
+ date: 2012-09-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json-schema
@@ -223,7 +223,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
223
223
  version: '0'
224
224
  segments:
225
225
  - 0
226
- hash: 2719553250962726743
226
+ hash: -2997986651256795952
227
227
  required_rubygems_version: !ruby/object:Gem::Requirement
228
228
  none: false
229
229
  requirements:
@@ -232,7 +232,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
232
232
  version: '0'
233
233
  segments:
234
234
  - 0
235
- hash: 2719553250962726743
235
+ hash: -2997986651256795952
236
236
  requirements: []
237
237
  rubyforge_project:
238
238
  rubygems_version: 1.8.24