class Devise::CasActionUrlFactoryBase
Attributes
action[R]
base_url[R]
mapping[R]
Public Class Methods
new(base_url, mapping, action)
click to toggle source
# File lib/devise_cas_authenticatable/cas_action_url_factory_base.rb, line 15 def initialize(base_url, mapping, action) @base_url = base_url @mapping = mapping @action = action end
prepare_class()
click to toggle source
# File lib/devise_cas_authenticatable/cas_action_url_factory_base.rb, line 5 def self.prepare_class Class.new(self) do include Rails.application.routes.url_helpers if Rails.application.routes.respond_to?(:mounted_helpers) && Rails.application.routes.mounted_helpers include Rails.application.routes.mounted_helpers end end end
Public Instance Methods
call()
click to toggle source
# File lib/devise_cas_authenticatable/cas_action_url_factory_base.rb, line 21 def call uri = URI.parse(base_url).tap { |uri| uri.query = nil } uri.path = load_base_path uri.to_s end
Also aliased as: build
Private Instance Methods
load_base_path()
click to toggle source
# File lib/devise_cas_authenticatable/cas_action_url_factory_base.rb, line 30 def load_base_path load_routes_path || load_mapping_path end
load_mapping_path()
click to toggle source
# File lib/devise_cas_authenticatable/cas_action_url_factory_base.rb, line 48 def load_mapping_path path = mapping_fullpath || mapping_raw_path path << "/" unless path =~ /\/$/ path << action path end
load_routes_path()
click to toggle source
# File lib/devise_cas_authenticatable/cas_action_url_factory_base.rb, line 34 def load_routes_path router_name = mapping.router_name || Devise.available_router_name context = send(router_name) route = "#{mapping.singular}_#{action}_path" if context.respond_to? route context.send route else nil end rescue NameError, NoMethodError nil end
mapping_fullpath()
click to toggle source
# File lib/devise_cas_authenticatable/cas_action_url_factory_base.rb, line 55 def mapping_fullpath return nil unless mapping.respond_to?(:fullpath) "#{rails_relative_url_root}#{mapping.fullpath}" end
mapping_raw_path()
click to toggle source
# File lib/devise_cas_authenticatable/cas_action_url_factory_base.rb, line 60 def mapping_raw_path "#{rails_relative_url_root}#{mapping.raw_path}" end
rails_relative_url_root()
click to toggle source
# File lib/devise_cas_authenticatable/cas_action_url_factory_base.rb, line 64 def rails_relative_url_root ENV['RAILS_RELATIVE_URL_ROOT'] end