Module: Waves::Runtime

Included in:
Console, Rackup, Server
Defined in:
lib/waves/runtime/runtime.rb

Class Attribute Summary collapse

Instance Method Summary collapse

Class Attribute Details

.instanceObject

Returns the value of attribute instance.



7
8
9
# File 'lib/waves/runtime/runtime.rb', line 7

def instance
  @instance
end

Instance Method Details

#configObject

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.

Returns:

  • (Boolean)


21
# File 'lib/waves/runtime/runtime.rb', line 21

def debug? ; options[:debugger] or config.debug ; end

#loadObject

Create a new Waves application instance.



10
11
12
13
14
15
# File 'lib/waves/runtime/runtime.rb', line 10

def load
  Dir.chdir( options[:directory] ) if options[:directory]
  Kernel.load( options[:startup] || 'startup.rb' )
  Runtime.instance = self
  options[:logger] ||= logger
end

#loggerObject

Start and / or access the Waves::Logger instance.



30
# File 'lib/waves/runtime/runtime.rb', line 30

def logger ; @log ||= Waves::Logger.start ; end

#modeObject

The ‘mode’ of the runtime determines which configuration it will run under.



18
# File 'lib/waves/runtime/runtime.rb', line 18

def mode ; options[:mode]||:development ; end

#reloadObject

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

Returns:

  • (Boolean)


34
# File 'lib/waves/runtime/runtime.rb', line 34

def synchronize? ; !options[ :turbo ] ; end