rack-mount 0.6.11 → 0.6.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -39,6 +39,12 @@ module Rack::Mount
39
39
  end
40
40
 
41
41
  def separators(key)
42
+ @separators ||= {}
43
+ @separators[key] ||= lookup_separators(key)
44
+ end
45
+ attr_writer :separators
46
+
47
+ def lookup_separators(key)
42
48
  @boundaries[key].keys_in_upper_quartile
43
49
  end
44
50
 
@@ -326,7 +326,7 @@ module Rack::Mount
326
326
  @routes.each_with_index do |route, index|
327
327
  catch(:skip) do
328
328
  k = keys.map { |key| block.call(key, index) }
329
- Utils.pop_trailing_nils!(k)
329
+ Utils.pop_trailing_blanks!(k)
330
330
  k.map! { |key| key || /.*/ }
331
331
  graph[*k] = route
332
332
  end
@@ -46,16 +46,17 @@ module Rack::Mount
46
46
 
47
47
  # Removes trailing nils from array.
48
48
  #
49
- # pop_trailing_nils!([1, 2, 3]) # => [1, 2, 3]
50
- # pop_trailing_nils!([1, 2, 3, nil, nil]) # => [1, 2, 3]
51
- # pop_trailing_nils!([nil]) # => []
52
- def pop_trailing_nils!(ary)
53
- while ary.length > 0 && ary.last.nil?
49
+ # pop_trailing_blanks!([1, 2, 3]) # => [1, 2, 3]
50
+ # pop_trailing_blanks!([1, 2, 3, nil, ""]) # => [1, 2, 3]
51
+ # pop_trailing_blanks!([nil]) # => []
52
+ # pop_trailing_blanks!([""]) # => []
53
+ def pop_trailing_blanks!(ary)
54
+ while ary.length > 0 && (ary.last.nil? || ary.last == '')
54
55
  ary.pop
55
56
  end
56
57
  ary
57
58
  end
58
- module_function :pop_trailing_nils!
59
+ module_function :pop_trailing_blanks!
59
60
 
60
61
  RESERVED_PCHAR = ':@&=+$,;%'
61
62
  SAFE_PCHAR = "#{URI::REGEXP::PATTERN::UNRESERVED}#{RESERVED_PCHAR}"
@@ -1,3 +1,3 @@
1
1
  module Rack::Mount
2
- Version = '0.6.11'
2
+ Version = '0.6.12'
3
3
  end
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: 17
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 11
10
- version: 0.6.11
9
+ - 12
10
+ version: 0.6.12
11
11
  platform: ruby
12
12
  authors:
13
13
  - Joshua Peek
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-08-20 00:00:00 -05:00
18
+ date: 2010-08-22 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency