Class: PatriciaApp::App

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/patricia/app.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.generate_routesObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/patricia/app.rb', line 10

def self.generate_routes
  # CSS
  settings.app_css.each do |dir|
    get dir do
      content_type 'text/css'
      File.new(File.join(settings.app_css_dir, dir)).readlines
    end
  end

  # JS
  settings.app_js.each do |dir|
    get dir do
      content_type 'text/js'
      File.new(File.join(settings.app_js_dir, dir)).readlines
    end
  end
end

Instance Method Details

#_without_extension(path) ⇒ Object

‘patricia.rb’ already defines this, but redefining it here decouples the web app from the static file generator.



328
329
330
# File 'lib/patricia/app.rb', line 328

def _without_extension(path)
  path.sub(/\..*$/, '')
end