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.
35 36 37 38 39 40 |
# File 'lib/runtime/application.rb', line 35 def initialize( ={} ) @options = 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.
29 30 31 |
# File 'lib/runtime/application.rb', line 29 def instance @instance end |
Instance Attribute Details
#options ⇒ Object (readonly)
Accessor for options passed to the application.
32 33 34 |
# File 'lib/runtime/application.rb', line 32 def @options end |
Instance Method Details
#cache ⇒ Object
Returns the cache set for the current configuration
66 |
# File 'lib/runtime/application.rb', line 66 def cache ; config.cache ; end |
#config ⇒ Object
Access the current configuration. Example: Waves::Server.config
55 56 57 |
# File 'lib/runtime/application.rb', line 55 def config Waves.application.configurations[ mode ] end |
#debug? ⇒ Boolean
Debug is true if debug is set to true in the current configuration.
52 |
# File 'lib/runtime/application.rb', line 52 def debug? ; config.debug ; end |
#mapping ⇒ Object
Access the mappings for the application.
60 |
# File 'lib/runtime/application.rb', line 60 def mapping ; Waves.application.configurations[ :mapping ] ; end |
#mode ⇒ Object
The ‘mode’ of the application determines which configuration it will run under.
47 48 49 |
# File 'lib/runtime/application.rb', line 47 def mode @mode ||= @options[:mode]||:development end |
#reload ⇒ Object
Reload the modules specified in the current configuration.
63 |
# File 'lib/runtime/application.rb', line 63 def reload ; config.reloadable.each { |mod| mod.reload } ; end |
#synchronize(&block) ⇒ Object
42 43 44 |
# File 'lib/runtime/application.rb', line 42 def synchronize( &block ) ( @mutex ||= Mutex.new ).synchronize( &block ) end |