rack-http_router 0.0.36 → 0.0.38
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.
- checksums.yaml +4 -4
 - data/lib/rack-http_router/action.rb +0 -12
 - data/lib/rack-http_router/middleware.rb +23 -0
 - metadata +3 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: f46b50ce0912d026e3c71fc069174e0baf917c7b8f2bc80cbd5c4bf064a3dad1
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 5956a72b92894029eda8114e8e7351b780dd405264af8c4a7b4d9fff3fca64bc
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: a8ab0aa5c6f213dc361053c30be7aea365aa1e2f1ecd692d7468e1a7bf911df5fb078452a04bcbf31de284a246aeaab3fb4cb2eeec739a47e9a72a68b5613393
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 7a8018bf21863e5c1c21da1dd5a0bfabb73da499e0d214a4b2190e16414b3bc3bd6f029c4e0558de1b850fc05a54525dd6fa0cf62df858899ce4f70e4d5bde7e
         
     | 
| 
         @@ -48,10 +48,6 @@ module Rack 
     | 
|
| 
       48 
48 
     | 
    
         
             
                    Rack::HttpRouter::Action.layout(layout_path, file_path)
         
     | 
| 
       49 
49 
     | 
    
         
             
                  end
         
     | 
| 
       50 
50 
     | 
    
         | 
| 
       51 
     | 
    
         
            -
                  def assign(obj, hash)
         
     | 
| 
       52 
     | 
    
         
            -
                    Rack::HttpRouter::Action.assign(obj, hash)
         
     | 
| 
       53 
     | 
    
         
            -
                  end
         
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
51 
     | 
    
         
             
                  def html(content, status: 200)
         
     | 
| 
       56 
52 
     | 
    
         
             
                    Rack::HttpRouter::Action.html(content, status: status)
         
     | 
| 
       57 
53 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -166,14 +162,6 @@ module Rack 
     | 
|
| 
       166 
162 
     | 
    
         
             
                      ]
         
     | 
| 
       167 
163 
     | 
    
         
             
                    end
         
     | 
| 
       168 
164 
     | 
    
         | 
| 
       169 
     | 
    
         
            -
                    def assign(obj, hash)
         
     | 
| 
       170 
     | 
    
         
            -
                      hash.each do |k, v|
         
     | 
| 
       171 
     | 
    
         
            -
                        obj.define_singleton_method(k) { v }
         
     | 
| 
       172 
     | 
    
         
            -
                      end
         
     | 
| 
       173 
     | 
    
         
            -
             
     | 
| 
       174 
     | 
    
         
            -
                      obj
         
     | 
| 
       175 
     | 
    
         
            -
                    end
         
     | 
| 
       176 
     | 
    
         
            -
             
     | 
| 
       177 
165 
     | 
    
         
             
                    def html(content, status: 200)
         
     | 
| 
       178 
166 
     | 
    
         
             
                      [status, { 'Content-Type' => 'text/html' }, [content]]
         
     | 
| 
       179 
167 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -0,0 +1,23 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Rack
         
     | 
| 
      
 2 
     | 
    
         
            +
              class HttpRouter
         
     | 
| 
      
 3 
     | 
    
         
            +
                module Middleware
         
     | 
| 
      
 4 
     | 
    
         
            +
                  def self.included(base)
         
     | 
| 
      
 5 
     | 
    
         
            +
                    base.class_eval do
         
     | 
| 
      
 6 
     | 
    
         
            +
                      include Rack::HttpRouter::Action
         
     | 
| 
      
 7 
     | 
    
         
            +
                    end
         
     | 
| 
      
 8 
     | 
    
         
            +
                  end
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                  def assign(obj, hash)
         
     | 
| 
      
 11 
     | 
    
         
            +
                    Rack::HttpRouter::Middleware.assign(obj, hash)
         
     | 
| 
      
 12 
     | 
    
         
            +
                  end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                  def self.assign(obj, hash)
         
     | 
| 
      
 15 
     | 
    
         
            +
                    hash.each do |k, v|
         
     | 
| 
      
 16 
     | 
    
         
            +
                      obj.define_singleton_method(k) { v }
         
     | 
| 
      
 17 
     | 
    
         
            +
                    end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                    obj
         
     | 
| 
      
 20 
     | 
    
         
            +
                  end
         
     | 
| 
      
 21 
     | 
    
         
            +
                end
         
     | 
| 
      
 22 
     | 
    
         
            +
              end
         
     | 
| 
      
 23 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: rack-http_router
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.38
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Henrique F. Teixeira
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2023- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2023-08-02 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: erubi
         
     | 
| 
         @@ -66,6 +66,7 @@ extra_rdoc_files: [] 
     | 
|
| 
       66 
66 
     | 
    
         
             
            files:
         
     | 
| 
       67 
67 
     | 
    
         
             
            - lib/rack-http_router.rb
         
     | 
| 
       68 
68 
     | 
    
         
             
            - lib/rack-http_router/action.rb
         
     | 
| 
      
 69 
     | 
    
         
            +
            - lib/rack-http_router/middleware.rb
         
     | 
| 
       69 
70 
     | 
    
         
             
            - lib/rack-http_router/router.rb
         
     | 
| 
       70 
71 
     | 
    
         
             
            - lib/rack-http_router/router/build_request.rb
         
     | 
| 
       71 
72 
     | 
    
         
             
            - lib/rack-http_router/router/route.rb
         
     |