rack-mount 0.7.1 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -110,7 +110,7 @@ module Rack::Mount
110
110
  def remove_metaclass_method(symbol)
111
111
  metaclass = class << self; self; end
112
112
  Utils.silence_debug { metaclass.send(:remove_method, symbol) }
113
- rescue NameError => e
113
+ rescue NameError
114
114
  nil
115
115
  end
116
116
  end
@@ -54,10 +54,9 @@ module Rack::Mount
54
54
  @named_captures = {}
55
55
  @conditions.map { |method, condition|
56
56
  next unless condition.respond_to?(:named_captures)
57
- @named_captures[method] = condition.named_captures.inject({}) { |named_captures, (k, v)|
58
- named_captures[k.to_sym] = v.last - 1
59
- named_captures
60
- }.freeze
57
+ @named_captures[method] = Hash[condition.named_captures.map { |k, v|
58
+ [k.to_sym, v.last - 1]
59
+ }].freeze
61
60
  }
62
61
  @named_captures.freeze
63
62
 
@@ -98,12 +97,9 @@ module Rack::Mount
98
97
 
99
98
  def generate(method, params = {}, recall = {}, options = {})
100
99
  if method.nil?
101
- result = @conditions.inject({}) { |h, (m, condition)|
102
- if condition.respond_to?(:generate)
103
- h[m] = condition.generate(params, recall, options)
104
- end
105
- h
106
- }
100
+ result = Hash[@conditions.map { |m, condition|
101
+ [m, condition.generate(params, recall, options)] if condition.respond_to?(:generate)
102
+ }]
107
103
  return nil if result.values.compact.empty?
108
104
  else
109
105
  if condition = @conditions[method]
@@ -127,7 +127,7 @@ module Rack::Mount
127
127
 
128
128
  # Rack compatible recognition and dispatching method. Routes are
129
129
  # tried until one returns a non-catch status code. If no routes
130
- # match, the catch status code is returned.
130
+ # match, then catch status code is returned.
131
131
  #
132
132
  # This method can only be invoked after the RouteSet has been
133
133
  # finalized.
@@ -162,7 +162,7 @@ module Rack::Mount
162
162
  # Additional parameters can be passed in as a hash
163
163
  # url(env, :people, :id => "1") # => "/people/1"
164
164
  #
165
- # If no name route is given, it will fall back to a slower
165
+ # If no named route is given, it will fall back to a slower
166
166
  # generation search.
167
167
  # url(env, :controller => "people", :action => "show", :id => "1")
168
168
  # # => "/people/1"
@@ -116,7 +116,7 @@ module Rack::Mount
116
116
  module_function :regexp_anchored?
117
117
 
118
118
  def normalize_extended_expression(regexp)
119
- return regexp unless regexp.options & Regexp::EXTENDED != 0
119
+ return regexp if (regexp.options & Regexp::EXTENDED) == 0
120
120
  source = regexp.source
121
121
  source.gsub!(/#.+$/, '')
122
122
  source.gsub!(/\s+/, '')
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-mount
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
- - 1
10
- version: 0.7.1
9
+ - 2
10
+ version: 0.7.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Joshua Peek
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
133
  requirements: []
134
134
 
135
135
  rubyforge_project: rack-mount
136
- rubygems_version: 1.5.3
136
+ rubygems_version: 1.6.2
137
137
  signing_key:
138
138
  specification_version: 3
139
139
  summary: Stackable dynamic tree based Rack router