class Restfulness::Application
The Restulness::Application is the starting point. It'll deal with defining the initial configuration, and handle incoming requests from rack.
Build your own Restfulness
applications by inheriting from this class:
class MyApp < Restfulness::Application routes do scope 'api' do # scope not supported yet! add 'journey', JourneyResource add 'journeys', JourneyCollectionResource end end end
Attributes
middlewares[RW]
router[RW]
Protected Class Methods
logger()
click to toggle source
Quick access to the Restfulness
logger.
# File lib/restfulness/application.rb, line 69 def logger Restfulness.logger end
logger=(logger)
click to toggle source
Override the default Restfulness
logger.
# File lib/restfulness/application.rb, line 74 def logger=(logger) Restfulness.logger = logger end
routes(&block)
click to toggle source
# File lib/restfulness/application.rb, line 51 def routes(&block) # Store the block so we can parse it at run time (autoload win!) @router = Router.new(&block) end
Public Instance Methods
call(env)
click to toggle source
Rack Handling. Forward rack call to dispatcher
# File lib/restfulness/application.rb, line 29 def call(env) @app ||= build_rack_app @app.call(env) end
router()
click to toggle source
# File lib/restfulness/application.rb, line 23 def router self.class.router end
Protected Instance Methods
build_rack_app()
click to toggle source
# File lib/restfulness/application.rb, line 36 def build_rack_app this = self dispatcher = Dispatchers::Rack.new(self) Rack::Builder.new do this.class.middlewares.each do |middleware| use middleware end run dispatcher end end