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.
34 35 36 |
# File 'lib/runtime/runtime.rb', line 34 def instance @instance end |
Instance Attribute Details
#options ⇒ Object (readonly)
Accessor for options passed to the runtime.
37 38 39 |
# File 'lib/runtime/runtime.rb', line 37 def @options end |
Instance Method Details
#config ⇒ Object
Returns the current configuration.
53 |
# File 'lib/runtime/runtime.rb', line 53 def config ; Waves.main::Configurations[ mode ] ; end |
#debug? ⇒ Boolean
Returns true if debug was set to true in the current configuration.
50 |
# File 'lib/runtime/runtime.rb', line 50 def debug? ; [:debugger] or config.debug ; end |
#log ⇒ Object
Start and / or access the Waves::Logger instance.
59 |
# File 'lib/runtime/runtime.rb', line 59 def log ; @log ||= Waves::Logger.start ; end |
#mode ⇒ Object
The ‘mode’ of the runtime determines which configuration it will run under.
47 |
# File 'lib/runtime/runtime.rb', line 47 def mode ; [:mode]||:development ; end |
#reload ⇒ Object
Reload the modules specified in the current configuration.
56 |
# File 'lib/runtime/runtime.rb', line 56 def reload ; config.reloadable.each { |mod| mod.reload } ; end |
#synchronize(&block) ⇒ Object
Provides access to the server mutex for thread-safe operation.
62 |
# File 'lib/runtime/runtime.rb', line 62 def synchronize( &block ) ; ( @mutex ||= Mutex.new ).synchronize( &block ) ; end |
#synchronize? ⇒ Boolean
63 |
# File 'lib/runtime/runtime.rb', line 63 def synchronize? ; ![ :turbo ] ; end |