module Sinatra::Rabbit
Constants
- STANDARD_OPERATIONS
Public Class Methods
configuration()
click to toggle source
# File lib/sinatra/rabbit/base.rb, line 59 def self.configuration Thread.current[:rabbit_configuration] ||= {} end
configure(&block)
click to toggle source
# File lib/sinatra/rabbit/base.rb, line 55 def self.configure(&block) instance_eval(&block) end
disable(property)
click to toggle source
# File lib/sinatra/rabbit/base.rb, line 75 def self.disable(property) configuration[property] = false end
disabled?(property)
click to toggle source
# File lib/sinatra/rabbit/base.rb, line 71 def self.disabled?(property) !configuration[property].nil? and configuration[property] == false end
enable(property)
click to toggle source
# File lib/sinatra/rabbit/base.rb, line 63 def self.enable(property) configuration[property] = true end
enabled?(property)
click to toggle source
# File lib/sinatra/rabbit/base.rb, line 67 def self.enabled?(property) !configuration[property].nil? and configuration[property] == true end
included(base)
click to toggle source
Automatically register the DSL to Sinatra::Base if this module is included:
Example:
class MyApp << Sinatra::Base include Sinatra::Rabbit end
# File lib/sinatra/rabbit/base.rb, line 93 def self.included(base) configuration[:root_path] ||= '/' base.register(Rabbit::DSL) if base.respond_to? :register if configuration[:use_namespace] configuration[:base_module] = const_get(base.name.split('::').first) end base.get '/docs' do css_file = File.read(File.join(File.dirname(__FILE__), '..', 'docs', 'bootstrap.min.css')) index_file = File.read(File.join(File.dirname(__FILE__), '..', 'docs', 'api.haml')) haml index_file, :locals => { :base => base.respond_to?(:documentation_class) ? base.documentation_class : base, :css => css_file } end end
set(property, value)
click to toggle source
# File lib/sinatra/rabbit/base.rb, line 79 def self.set(property, value) configuration[property] = value end