Module: Spinebox::Routes

Defined in:
lib/spinebox/routes.rb

Class Method Summary collapse

Class Method Details

.appObject

The rack app



26
27
28
# File 'lib/spinebox/routes.rb', line 26

def self.app
  @@app
end

.draw(&block) ⇒ Object

Draw the routes into a rack builder app



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/spinebox/routes.rb', line 11

def self.draw(&block)      
  @@app = Rack::Builder.app do
    
    # Reload on every request?
    if Spinebox.config.reload
      use Spinebox::Reloader
      use Rack::Reloader, 0
    end
    
    # Mapping from routes.rb
    instance_eval(&block)
  end
end

.reset!Object

Reset the routes



5
6
7
# File 'lib/spinebox/routes.rb', line 5

def self.reset!
  @@app = nil
end