Sha256: 4565ba5e85f705dfb3aae20212aa3926cee080e529093cab72f8631449dec2e9
Contents?: true
Size: 1.39 KB
Versions: 3
Compression:
Stored size: 1.39 KB
Contents
$:.unshift( "../lib" ) require 'capcode' module Capcode class HTTPError def r404(f, h) h['Content-Type'] = 'text/plain' "You are here ---> X (#{f})" end end # Access via GET /index class Index < Route def get render :markaby => :index end end # Acces via GET /foo_bar class FooBar < Route def get render "Hello FooBar!" end end # Access via GET /bar class Foo < Route '/bar' def get render "Hello Foo!" end end class RegexpOne < Route '/one/(.*)' def get(x) render "RegexpOne with '#{x}'" end end class RegexpTwo < Route '/two/([^\/]*)/two' def get(x) render "RegexpTwo with '#{x}'" end end class RegexpThree < Route '/three/with/([^\/]*)/and/(.*)', '/three/(.*)' def get(x, y) render "RegexpThree with '#{x}' and '#{y}'" end end end module Capcode::Views def index html do body do a "FooBar", :href => URL(Capcode::FooBar); br; a "Foo", :href => URL(Capcode::Foo); br; a "RegexpOne", :href => URL(Capcode::RegexpOne, "Hello World"); br; a "RegexpTwo", :href => URL(Capcode::RegexpTwo, "Hello World"); br; a "RegexpThree", :href => URL(Capcode::RegexpThree, "Hello", "World"); br; a "RegexpThree (again)", :href => URL(Capcode::RegexpThree, "Hello World"); br; end end end end Capcode.run()
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
Capcode-0.9.6 | examples/route.rb |
Capcode-0.9.5 | examples/route.rb |
Capcode-0.9.4 | examples/route.rb |