Module: Cuba::Sugar::Routes

Included in:
Cuba::Sugar
Defined in:
lib/cuba/sugar/routes.rb

Instance Method Summary collapse

Instance Method Details

#optionsObject

Public: Sugar to access an option verb

Examples:

on options do
  as_json do
    API.interaction_methods
  end
end


12
13
14
# File 'lib/cuba/sugar/routes.rb', line 12

def options
  req.options?
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