rack-mount 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -63,20 +63,20 @@ module Rack::Mount
63
63
  if index > 0
64
64
  previous = parts[index-1]
65
65
  if previous.literal?
66
- boundaries << previous.value
66
+ boundaries << previous.to_s
67
67
  end
68
68
  end
69
69
 
70
70
  if inside = part[0][0]
71
71
  if inside.literal?
72
- boundaries << inside.value
72
+ boundaries << inside.to_s
73
73
  end
74
74
  end
75
75
 
76
76
  if index < parts.length
77
77
  following = parts[index+1]
78
78
  if following.literal?
79
- boundaries << following.value
79
+ boundaries << following.to_s
80
80
  end
81
81
  end
82
82
  end
@@ -12,8 +12,9 @@ module Rack::Mount
12
12
 
13
13
  private
14
14
  def expire!
15
+ remove_metaclass_method :recognize
16
+
15
17
  class << self
16
- undef :recognize
17
18
  alias_method :recognize, :_expired_recognize
18
19
  end
19
20
 
@@ -63,8 +64,9 @@ module Rack::Mount
63
64
  end
64
65
  }.join(', ')
65
66
 
67
+ remove_metaclass_method :recognize
68
+
66
69
  instance_eval(<<-RUBY, __FILE__, __LINE__)
67
- undef :recognize
68
70
  def recognize(obj, &block)
69
71
  cache = {}
70
72
  container = @recognition_graph[#{keys}]
@@ -84,6 +86,16 @@ module Rack::Mount
84
86
  end
85
87
  RUBY
86
88
  end
89
+
90
+ # method_defined? can't distinguish between instance
91
+ # and meta methods. So we have to rescue if the method
92
+ # has not been defined in the metaclass yet.
93
+ def remove_metaclass_method(symbol)
94
+ metaclass = class << self; self; end
95
+ metaclass.send(:remove_method, symbol)
96
+ rescue NameError => e
97
+ nil
98
+ end
87
99
  end
88
100
  end
89
101
  end
@@ -36,7 +36,7 @@ module Rack::Mount
36
36
  end
37
37
  @app = app
38
38
 
39
- @name = name.to_sym if name
39
+ @name = name ? name.to_sym : nil
40
40
  @defaults = (defaults || {}).freeze
41
41
 
42
42
  unless conditions.is_a?(Hash)
@@ -164,7 +164,7 @@ class Multimap < Hash
164
164
  # Ignore alias_method since the definition above serves
165
165
  # as its documentation.
166
166
  #++
167
- undef :each_association
167
+ remove_method :each_association
168
168
  module_eval "alias_method :each_association, :each_pair"
169
169
 
170
170
  # call-seq:
@@ -5,14 +5,12 @@
5
5
  #
6
6
 
7
7
  require 'racc/parser.rb'
8
-
9
- require 'reginald/tokenizer'
10
-
11
8
  module Reginald
12
9
  class Parser < Racc::Parser
13
10
 
14
11
  attr_accessor :capture_index
15
12
  attr_accessor :capture_index_stack
13
+
16
14
  ##### State transition tables begin ###
17
15
 
18
16
  racc_action_table = [
@@ -385,3 +383,5 @@ end
385
383
 
386
384
  end # class Parser
387
385
  end # module Reginald
386
+
387
+ require 'reginald/tokenizer'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-mount
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Peek
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-22 00:00:00 -06:00
12
+ date: 2009-11-23 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency