Sha256: f4b30b6ba2232bd8bd62ea07dcf72cf57eca00b16579c736a16e7dc23aaea845

Contents?: true

Size: 620 Bytes

Versions: 9

Compression:

Stored size: 620 Bytes

Contents

module Spinebox
  module Routes
    
    # Reset the routes
    def self.reset!
      @@app = nil
    end
    reset!
    
    # Draw the routes into a rack builder app
    def self.draw(&block)
      @@app = Rack::Builder.new(&block).to_app
    end
    
    # The rack app
    def self.app
      @@app
    end
    
  end
  
  
  class << self
    
    # Returns a rack builder app with the drawn routes
    def app
      Routes.app || begin
        Spinebox.boot!
        Routes.app
      end
    end
    
    # Load the routes
    def load_routes!(routes = "./config/routes.rb")
      load routes
    end
    
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
spinebox-0.0.10 lib/spinebox/routes.rb
spinebox-0.0.9 lib/spinebox/routes.rb
spinebox-0.0.8 lib/spinebox/routes.rb
spinebox-0.0.7 lib/spinebox/routes.rb
spinebox-0.0.6 lib/spinebox/routes.rb
spinebox-0.0.5 lib/spinebox/routes.rb
spinebox-0.0.4 lib/spinebox/routes.rb
spinebox-0.0.3 lib/spinebox/routes.rb
spinebox-0.0.2 lib/spinebox/routes.rb