Module: Waves::Runtime
Class Attribute Summary collapse
-
.instance ⇒ Object
Returns the value of attribute instance.
Instance Method Summary collapse
-
#config ⇒ Object
Returns the current configuration.
-
#debug? ⇒ Boolean
Returns true if debug was set to true in the current configuration.
-
#load ⇒ Object
Create a new Waves application instance.
-
#logger ⇒ 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
Class Attribute Details
.instance ⇒ Object
Returns the value of attribute instance.
7 8 9 |
# File 'lib/waves/runtime/runtime.rb', line 7 def instance @instance end |
Instance Method Details
#config ⇒ Object
Returns the current configuration.
24 |
# File 'lib/waves/runtime/runtime.rb', line 24 def config ; Waves.main[:configurations][ mode ] ; end |
#debug? ⇒ Boolean
Returns true if debug was set to true in the current configuration.
21 |
# File 'lib/waves/runtime/runtime.rb', line 21 def debug? ; [:debugger] or config.debug ; end |
#load ⇒ Object
Create a new Waves application instance.
10 11 12 13 14 15 |
# File 'lib/waves/runtime/runtime.rb', line 10 def load Dir.chdir( [:directory] ) if [:directory] Kernel.load( [:startup] || 'startup.rb' ) Runtime.instance = self [:logger] ||= logger end |
#logger ⇒ Object
Start and / or access the Waves::Logger instance.
30 |
# File 'lib/waves/runtime/runtime.rb', line 30 def logger ; @log ||= Waves::Logger.start ; end |
#mode ⇒ Object
The ‘mode’ of the runtime determines which configuration it will run under.
18 |
# File 'lib/waves/runtime/runtime.rb', line 18 def mode ; [:mode]||:development ; end |
#reload ⇒ Object
Reload the modules specified in the current configuration.
27 |
# File 'lib/waves/runtime/runtime.rb', line 27 def reload ; config.reloadable.each { |mod| mod.reload } ; end |
#synchronize(&block) ⇒ Object
Provides access to the server mutex for thread-safe operation.
33 |
# File 'lib/waves/runtime/runtime.rb', line 33 def synchronize( &block ) ; ( @mutex ||= Mutex.new ).synchronize( &block ) ; end |
#synchronize? ⇒ Boolean
34 |
# File 'lib/waves/runtime/runtime.rb', line 34 def synchronize? ; ![ :turbo ] ; end |