class Controll::Enabler::PathHandler

Attributes

control_action[R]
controller[R]
options[R]
path[R]
type[R]

Public Class Methods

new(controller, type) click to toggle source
# File lib/controll/enabler/path_handler.rb, line 5
def initialize controller, type
  @controller, @type = [controller, type]
end
redirecter(controller, map) click to toggle source
# File lib/controll/enabler/path_handler.rb, line 13
def self.redirecter controller, map
  self.new controller, map, :redirect
end
renderer(controller, map) click to toggle source
# File lib/controll/enabler/path_handler.rb, line 9
def self.renderer controller, map
  self.new controller, map, :render
end

Public Instance Methods

execute(*args) click to toggle source
# File lib/controll/enabler/path_handler.rb, line 17
def execute *args
  extract! *args
  process_notifications
  path ? handle_path : fallback
end

Protected Instance Methods

extract!(*args) click to toggle source
# File lib/controll/enabler/path_handler.rb, line 39
def extract! *args
  @options = args.extract_options!
  action = args.first
  @path = path_resolver(map).resolve action
end
fallback() click to toggle source
# File lib/controll/enabler/path_handler.rb, line 35
def fallback
  controller.do_fallback action
end
handle_path() click to toggle source
# File lib/controll/enabler/path_handler.rb, line 31
def handle_path
  controller.send control_action, path, options
end
map() click to toggle source
# File lib/controll/enabler/path_handler.rb, line 25
def map
  @map ||= controller.class.send("#{type}_map") 
end
path_resolver(map) click to toggle source
# File lib/controll/enabler/path_handler.rb, line 45
def path_resolver map
  @path_resolver ||= PathResolver.new controller, map
end