Module: Sinatra::Chicago

Defined in:
lib/chicago/helpers.rb,
lib/chicago/responders.rb,
lib/chicago/application.rb

Defined Under Namespace

Modules: Helpers, Responders

Instance Method Summary collapse

Instance Method Details

#catch_all_css(path = '/stylesheets') ⇒ Object

Assumes all CSS is SASS and is referenced as being in a directory named stylesheets If SASS file is not defined, the route will passed on to - theoretically - the real CSS in the public directory.



7
8
9
10
11
12
13
14
15
16
# File 'lib/chicago/application.rb', line 7

def catch_all_css(path='/stylesheets')
  get("#{path}/*.css") do
    begin
      content_type 'text/css'
      sass params["splat"].first.to_sym
    rescue Errno::ENOENT
      pass
    end
  end
end

#get_obvious(name) ⇒ Object

When you don’t want anything special, but to load a named view as HAML.



19
20
21
22
23
# File 'lib/chicago/application.rb', line 19

def get_obvious(name)
  get "/#{name}" do
    haml name.to_sym
  end
end