Module: Excursion::Helpers::ApplicationHelper

Included in:
StaticHelper
Defined in:
lib/excursion/helpers/application_helper.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/excursion/helpers/application_helper.rb', line 15

def method_missing(meth, *args)
  if app_exists?(meth.to_s)
    excursion(meth.to_s)
  else
    super
  end
end

Instance Method Details

#excursion(app_name) ⇒ Object

Returns an Excursion::Helpers::ApplicationHelper if the app exists in the route pool.

Raises an exception if the requested app is not in the route pool.

Raises:



8
9
10
11
12
13
# File 'lib/excursion/helpers/application_helper.rb', line 8

def excursion(app_name)
  raise NotInPool, "Application is not registered in the excursion route pool: '#{app_name}'" unless app_exists?(app_name)
  
  return Helpers.helper(app_name) unless Helpers.helper(app_name).nil?
  Helpers.register_helper(UrlHelper.new(excursion_app(app_name)))
end

#respond_to_missing?(meth, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/excursion/helpers/application_helper.rb', line 23

def respond_to_missing?(meth, include_private=false)
  app_exists?(meth.to_s) || super
end