rack-mount 0.7.1 → 0.7.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.
- data/lib/rack/mount/code_generation.rb +1 -1
 - data/lib/rack/mount/route.rb +6 -10
 - data/lib/rack/mount/route_set.rb +2 -2
 - data/lib/rack/mount/utils.rb +1 -1
 - metadata +4 -4
 
    
        data/lib/rack/mount/route.rb
    CHANGED
    
    | 
         @@ -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. 
     | 
| 
       58 
     | 
    
         
            -
                       
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       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. 
     | 
| 
       102 
     | 
    
         
            -
                      if condition.respond_to?(:generate)
         
     | 
| 
       103 
     | 
    
         
            -
             
     | 
| 
       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]
         
     | 
    
        data/lib/rack/mount/route_set.rb
    CHANGED
    
    | 
         @@ -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,  
     | 
| 
      
 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  
     | 
| 
      
 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"
         
     | 
    
        data/lib/rack/mount/utils.rb
    CHANGED
    
    | 
         @@ -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  
     | 
| 
      
 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:  
     | 
| 
      
 4 
     | 
    
         
            +
              hash: 7
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
              segments: 
         
     | 
| 
       7 
7 
     | 
    
         
             
              - 0
         
     | 
| 
       8 
8 
     | 
    
         
             
              - 7
         
     | 
| 
       9 
     | 
    
         
            -
              -  
     | 
| 
       10 
     | 
    
         
            -
              version: 0.7. 
     | 
| 
      
 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. 
     | 
| 
      
 136 
     | 
    
         
            +
            rubygems_version: 1.6.2
         
     | 
| 
       137 
137 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       138 
138 
     | 
    
         
             
            specification_version: 3
         
     | 
| 
       139 
139 
     | 
    
         
             
            summary: Stackable dynamic tree based Rack router
         
     |