module RackWarden::Frameworks

Attributes

selected_framework[RW]
parent_app[RW]

Methods extended into framework module ###

parent_app_class[RW]

Methods extended into framework module ###

parent_app_instance[RW]

Methods extended into framework module ###

Public Class Methods

extended(target) click to toggle source

Extend target with target (like saying 'extend self' within target).

# File lib/rack_warden/frameworks.rb, line 21
def extended(target)
  target.extend target
end
select_framework(env) click to toggle source

Select the framework of the parent app.

# File lib/rack_warden/frameworks.rb, line 9
def select_framework(env)
  App.logger.debug "RW framework constants: #{constants}"
  self.constants.dup.tap{|_constants| _constants.delete(:Base)}.each do |c|
    @selected_framework = self.const_get(c).framework_selector(env)
    break if @selected_framework
  end
  @selected_framework ||= Rack
  App.logger.info "RW selected framework #{@selected_framework}"
  @selected_framework
end

Public Instance Methods

framework_selector(app) click to toggle source

Sets framework module with variables from env (the scope of the parent app's initializer), and runs the framework selector logic. Returns the framework module or nil.

# File lib/rack_warden/frameworks.rb, line 34
def framework_selector(app)
    App.logger.debug "RW framework_selector #{self}"
  @parent_app_instance = app #env.eval 'parent_app_instance'
  @parent_app_class = @parent_app_instance.class
  @parent_app = @parent_app_instance.is_a?(Class) ? @parent_app_instance : @parent_app_class
  selector && self
end