Module: Excursion::Builders::ApplicationBuilder

Included in:
StaticBuilder
Defined in:
lib/excursion/builders/application_builder.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
# File 'lib/excursion/builders/application_builder.rb', line 15

def method_missing(meth, *args)
  excursion(meth.to_s)
rescue
  super
end

Instance Method Details

#excursion(app_name) ⇒ Object

Returns an Excursion::Builders::UrlBuilder 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/builders/application_builder.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 Builders.builder(app_name) unless Builders.builder(app_name).nil?
  Builders.register_builder(UrlBuilder.new(app_name))
end

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



21
22
23
# File 'lib/excursion/builders/application_builder.rb', line 21

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