Class: Waves::Runtime
Overview
A Waves::Runtime takes an inert application module and gives it concrete, pokeable form. Waves::Server and Waves::Console are types of runtime.
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 runtime.
Instance Method Summary collapse
-
#config ⇒ Object
Returns the current configuration.
-
#debug? ⇒ Boolean
Returns true if debug was set to true in the current configuration.
-
#initialize(options = {}) ⇒ Runtime
constructor
Create a new Waves application instance.
-
#log ⇒ Object
Start and / or access the Waves::Logger instance.
-
#mode ⇒ Object
The ‘mode’ of the runtime determines which configuration it will run under.
-
#reload ⇒ Object
Reload the modules specified in the current configuration.
-
#synchronize(&block) ⇒ Object
Provides access to the server mutex for thread-safe operation.
- #synchronize? ⇒ Boolean
Constructor Details
Class Attribute Details
.instance ⇒ Object
Returns the value of attribute instance.
36 37 38 |
# File 'lib/runtime/runtime.rb', line 36 def instance @instance end |
Instance Attribute Details
#options ⇒ Object (readonly)
Accessor for options passed to the runtime.
39 40 41 |
# File 'lib/runtime/runtime.rb', line 39 def @options end |
Instance Method Details
#config ⇒ Object
Returns the current configuration.
55 |
# File 'lib/runtime/runtime.rb', line 55 def config ; Waves.main::Configurations[ mode ] ; end |
#debug? ⇒ Boolean
Returns true if debug was set to true in the current configuration.
52 |
# File 'lib/runtime/runtime.rb', line 52 def debug? ; [:debugger] or config.debug ; end |
#log ⇒ Object
Start and / or access the Waves::Logger instance.
61 |
# File 'lib/runtime/runtime.rb', line 61 def log ; @log ||= Waves::Logger.start ; end |
#mode ⇒ Object
The ‘mode’ of the runtime determines which configuration it will run under.
49 |
# File 'lib/runtime/runtime.rb', line 49 def mode ; [:mode]||:development ; end |
#reload ⇒ Object
Reload the modules specified in the current configuration.
58 |
# File 'lib/runtime/runtime.rb', line 58 def reload ; config.reloadable.each { |mod| mod.reload } ; end |
#synchronize(&block) ⇒ Object
Provides access to the server mutex for thread-safe operation.
64 |
# File 'lib/runtime/runtime.rb', line 64 def synchronize( &block ) ; ( @mutex ||= Mutex.new ).synchronize( &block ) ; end |
#synchronize? ⇒ Boolean
65 |
# File 'lib/runtime/runtime.rb', line 65 def synchronize? ; ![ :turbo ] ; end |