Module: BigBand::BasicExtensions

Defined in:
lib/big_band/basic_extensions.rb

Overview

Basic Sinatra extension (mainly extending Sinatra’s standard methods, like set or register). Also it features a more advanced path guessing than Sinatra::Base. Normally you do not have to register this module manually, as the other extensions will do so if necessary.

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.registered(klass) ⇒ Object



159
160
161
162
163
164
165
166
167
168
169
# File 'lib/big_band/basic_extensions.rb', line 159

def self.registered(klass)
  klass.set :app_file, klass.caller_files.first.expand_path unless klass.app_file?
  klass.extend ClassMethods
  klass.send :include, InstanceMethods
  klass.set :haml, :format => :html5, :escape_html => true
  klass.use Rack::Session::Cookie
  klass.enable :sessions
  klass.get %r{/__big_band__/([^\.]+(\.[^\.]+)?)} do
    send_file(__FILE__.expand_path.dirname / :files / params[:captures].first)
  end
end

.set_app_file(klass) ⇒ Object



171
172
173
# File 'lib/big_band/basic_extensions.rb', line 171

def self.set_app_file(klass)
  klass.guessed_root = nil
end