Class: Waves::Application
Overview
An application in Waves is anything that provides access to the Waves runtime and the registered Waves applications. This includes both Waves::Server and Waves::Console. Waves::Application is not the actual application module(s) registered as Waves applications. To access the main Waves application, you can use Waves.application.
Class Attribute Summary collapse
-
.instance ⇒ Object
Returns the value of attribute instance.
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Accessor for options passed to the application.
Instance Method Summary collapse
-
#cache ⇒ Object
Returns the cache set for the current configuration.
-
#config ⇒ Object
Access the current configuration.
-
#debug? ⇒ Boolean
Debug is true if debug is set to true in the current configuration.
-
#initialize(options = {}) ⇒ Application
constructor
Create a new Waves application instance.
-
#mapping ⇒ Object
Access the mappings for the application.
-
#mode ⇒ Object
The ‘mode’ of the application determines which configuration it will run under.
-
#reload ⇒ Object
Reload the modules specified in the current configuration.
- #synchronize(&block) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Application
Create a new Waves application instance.
37 38 39 40 41 42 |
# File 'lib/runtime/application.rb', line 37 def initialize( ={} ) = Dir.chdir [:directory] if [:directory] Application.instance = self Kernel.load( :lib / 'application.rb' ) if Waves.application.nil? end |
Class Attribute Details
.instance ⇒ Object
Returns the value of attribute instance.
31 32 33 |
# File 'lib/runtime/application.rb', line 31 def instance @instance end |
Instance Attribute Details
#options ⇒ Object (readonly)
Accessor for options passed to the application. Valid options include
34 35 36 |
# File 'lib/runtime/application.rb', line 34 def end |
Instance Method Details
#cache ⇒ Object
Returns the cache set for the current configuration
62 |
# File 'lib/runtime/application.rb', line 62 def cache ; config.cache ; end |
#config ⇒ Object
Access the current configuration. Example: Waves::Server.config
53 |
# File 'lib/runtime/application.rb', line 53 def config ; Waves.application.configurations[ mode ] ; end |
#debug? ⇒ Boolean
Debug is true if debug is set to true in the current configuration.
50 |
# File 'lib/runtime/application.rb', line 50 def debug? ; config.debug ; end |
#mapping ⇒ Object
Access the mappings for the application.
56 |
# File 'lib/runtime/application.rb', line 56 def mapping ; Waves.application.configurations[ :mapping ] ; end |
#mode ⇒ Object
The ‘mode’ of the application determines which configuration it will run under.
47 |
# File 'lib/runtime/application.rb', line 47 def mode ; @mode ||= [:mode]||:development ; end |
#reload ⇒ Object
Reload the modules specified in the current configuration.
59 |
# File 'lib/runtime/application.rb', line 59 def reload ; config.reloadable.each { |mod| mod.reload } ; end |
#synchronize(&block) ⇒ Object
44 |
# File 'lib/runtime/application.rb', line 44 def synchronize( &block ) ; ( @mutex ||= Mutex.new ).synchronize( &block ) ; end |