Class: Fastr::Application

Inherits:
Object
  • Object
show all
Includes:
Dispatch, Log
Defined in:
lib/fastr/application.rb

Overview

This class represents a fastr application.

Author:

  • Chris Moos

Direct Known Subclasses

Test::Application

Defined Under Namespace

Modules: Handler

Constant Summary collapse

SETTINGS_FILE =

The file that contains application settings.

"app/config/settings.rb"
INIT_FILE =

The file that is evaluated when fastr finishes booting.

"app/config/init.rb"
@@load_paths =

These are resources we are watching to change. They will be reloaded upon change.

{
  :controller => "app/controllers/*.rb",
  :model => "app/models/*.rb",
  :lib => "lib/*.rb"
}

Constants included from Dispatch

Dispatch::PUBLIC_FOLDER

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Dispatch

#dispatch, #dispatch_controller, #dispatch_public, #do_dispatch, #plugin_after_dispatch, #plugin_before_dispatch, #setup_controller, #setup_controller_params

Methods included from Log

create_logger, included, level=

Constructor Details

#initialize(path) ⇒ Application

Sets the application’s initial state to booting and then kicks off the boot.



43
44
45
46
47
48
49
# File 'lib/fastr/application.rb', line 43

def initialize(path)
  self.app_path = path
  self.settings = Fastr::Settings.new(self)
  self.plugins = []
  @booting = true
  boot
end

Instance Attribute Details

#app_pathString

The full path the application’s path.

Returns:



24
25
26
# File 'lib/fastr/application.rb', line 24

def app_path
  @app_path
end

#pluginsArray

The list of plugins enabled for this application.

Returns:

  • (Array)


32
33
34
# File 'lib/fastr/application.rb', line 32

def plugins
  @plugins
end

#routerFastr::Router

The router for this application.

Returns:



20
21
22
# File 'lib/fastr/application.rb', line 20

def router
  @router
end

#settingsFastr::Settings

The settings for this application.

Returns:



28
29
30
# File 'lib/fastr/application.rb', line 28

def settings
  @settings
end

Instance Method Details

#plugin_after_bootObject



51
52
53
54
55
56
57
# File 'lib/fastr/application.rb', line 51

def plugin_after_boot
  self.plugins.each do |plugin|
    if plugin.respond_to? :after_boot
      new_env = plugin.send(:after_boot, self)
    end
  end
end