Module: Cuba::Sugar::Routes
- Included in:
- Cuba::Sugar
- Defined in:
- lib/cuba/sugar/routes.rb
Instance Method Summary collapse
-
#options ⇒ Object
Public: Sugar to access an option verb.
-
#subdomain(sub) ⇒ Object
Public: Sugar to do match a given subdomain.
Instance Method Details
#options ⇒ Object
Public: Sugar to access an option verb
Examples:
on do
as_json do
API.interaction_methods
end
end
12 13 14 |
# File 'lib/cuba/sugar/routes.rb', line 12 def req. end |
#subdomain(sub) ⇒ Object
Public: Sugar to do match a given subdomain. eg. blog.example.com
subdomain - subdomain to be checked
Examples:
on subdomain("blog") do
as do
run Blog
end
end
27 28 29 |
# File 'lib/cuba/sugar/routes.rb', line 27 def subdomain(sub) sub == req.host.split(".").first end |