Permalink
Browse files

Update Webmachine::Application to be compatible with example.

  • Loading branch information...
1 parent 362f21f commit 604ac812db5362ddb6551aefd7b165fe37f39b2d @emmanuel emmanuel committed Jan 4, 2012
Showing with 15 additions and 2 deletions.
  1. +11 −2 examples/application.rb
  2. +4 −0 lib/webmachine/application.rb
View
@@ -19,8 +19,17 @@ def to_html
end
MyApp = Webmachine::Application.new do |app|
- app.add_route(['fizz', :buzz, '*'], RouteDebugResource)
- app.add_route([:test, :foo, '*'], RouteDebugResource)
+ # Configure your app like this:
+ app.configure do |config|
+ config.port = 8888
+ config.adapter = :WEBrick
+ end
+ # And add routes like this:
+ app.add_route ['fizz', :buzz, '*'], RouteDebugResource
+ # OR add routes this way:
+ app.routes do
+ add [:test, :foo, '*'], RouteDebugResource
+ end
end
MyApp.run
@@ -1,3 +1,4 @@
+require 'forwardable'
require 'webmachine/configuration'
require 'webmachine/dispatcher'
@@ -17,6 +18,9 @@ module Webmachine
# MyApp.run
#
class Application
+ extend Forwardable
+
+ def_delegators :dispatcher, :add_route
# @return [Configuration] the current configuration
attr_accessor :configuration

0 comments on commit 604ac81

Please sign in to comment.