Created
August 27, 2009 02:34
-
-
Save joshbuddy/176043 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb(main):007:0> puts app.call(Rack::MockRequest.env_for("/hello")) | |
200 | |
Hello | |
=> nil | |
irb(main):008:0> | |
irb(main):009:0* | |
irb(main):010:0* | |
irb(main):011:0* quit | |
replacement:usher joshua$ irb | |
irb(main):001:0> require 'rubygems' | |
=> true | |
irb(main):002:0> require 'lib/usher' | |
=> true | |
irb(main):003:0> | |
irb(main):004:0* app = Usher::Interface.for(:rack) do | |
irb(main):005:1* add("/hello", :conditions => {:method => "POST"}).to(lambda {|env| [200, {}, "Hello"]}) | |
irb(main):006:1> end | |
=> #<Usher::Interface::RackInterface:0x57e0a4 @router=#<Usher:0x567bec @named_routes={}, @valid_regex="[0-9A-Za-z\\$\\-_\\+!\\*',]+", @delimiters_regex="/|\\.", @routes=[#<Usher::Route:0x14e35f8 @default_values=nil, @paths=[#<Usher::Route::Path:0x14e34a4 @parts=["/", "hello"], @route=#<Usher::Route:0x14e35f8 ...>, @dynamic=false>], @conditions={:method=>"POST"}, @requirements=nil, @router=#<Usher:0x567bec ...>, @destination=#<Proc:0x00591e38@(irb):5>, @match_partially=false>], @parser=#<Usher::Util::Parser::ParserInstance:0x14e36ac @split_regex=/((:|\*)?[0-9A-Za-z\$\-_\+!\*',]+|\/|\.|\(|\)|\||\{)/, @router=#<Usher:0x567bec ...>>, @generator=#<Usher::Util::Generators::URL:0x57a6fc @usher=#<Usher:0x567bec ...>>, @root=#<Usher::Node:0x14e87d8 @parent=#<Usher:0x567bec ...>, @exclusive_type=nil, @value=nil, @greedy_lookup={}, @lookup={"/"=>#<Usher::Node:0x14e3440 @parent=#<Usher::Node:0x14e87d8 ...>, @exclusive_type=nil, @value="/", @greedy_lookup={}, @lookup={"hello"=>#<Usher::Node:0x14e33f0 @terminates=#<Usher::Route::Path:0x14e34a4 @parts=["/", "hello"], @route=#<Usher::Route:0x14e35f8 @default_values=nil, @paths=[#<Usher::Route::Path:0x14e34a4 ...>], @conditions={:method=>"POST"}, @requirements=nil, @router=#<Usher:0x567bec ...>, @destination=#<Proc:0x00591e38@(irb):5>, @match_partially=false>, @dynamic=false>, @parent=#<Usher::Node:0x14e3440 ...>, @exclusive_type=nil, @value="hello", @greedy_lookup={}, @lookup={}>}>}, @request_methods=[:request_method, :host, :port, :scheme]>, @delimiter_chars=[47, 46], @grapher=#<Usher::Grapher:0x14e8788 @cache={}, @orders={}, @key_count={}, @significant_keys=nil>, @splitter=#<Usher::Splitter::SplitterInstance:0x14e87ec @url_split_regex=/[\/\.]|[^\/\.]+/>, @request_methods=[:request_method, :host, :port, :scheme], @delimiters=["/", "."]>> | |
irb(main):007:0> | |
irb(main):008:0* puts app.call(Rack::MockRequest.env_for("/hello")) | |
200 | |
Hello | |
=> nil | |
irb(main):009:0> puts app.call(Rack::MockRequest.env_for("/hello")) | |
200 | |
Hello | |
=> nil | |
irb(main):010:0> p app.call(Rack::MockRequest.env_for("/hello")) | |
[200, {}, "Hello"] | |
=> nil | |
irb(main):011:0> p app.call(Rack::MockRequest.env_for("/helloasd")) | |
[404, {"Content-Type"=>"text/plain", "Content-Length"=>"14"}, ["No route found"]] | |
=> nil | |
irb(main):012:0> p app.call(Rack::MockRequest.env_for("/hello")) | |
[200, {}, "Hello"] | |
=> nil | |
irb(main):013:0> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment