Module: Servolux

Defined in:
lib/servolux.rb

Defined Under Namespace

Modules: Threaded Classes: Child, Daemon, Piper, Prefork, Server

Constant Summary collapse

LIBPATH =

:stopdoc:

::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
PATH =
::File.dirname(LIBPATH) + ::File::SEPARATOR
Error =

Generic Servolux Error class.

Class.new(StandardError)

Class Method Summary collapse

Class Method Details

.fork?Boolean

Returns true if the execution platform supports fork.

Returns:

  • (Boolean)


44
45
46
# File 'lib/servolux.rb', line 44

def self.fork?
  RUBY_PLATFORM != 'java' and test(?e, '/dev/null')
end

.libpath(*args) ⇒ String

Returns the library path for the module. If any arguments are given, they will be joined to the end of the libray path using File.join.

Returns:

  • (String)

    absolute servolux ‘lib’ path



26
27
28
# File 'lib/servolux.rb', line 26

def self.libpath( *args )
  args.empty? ? LIBPATH : ::File.join(LIBPATH, args.flatten)
end

.path(*args) ⇒ String

Returns the lpath for the module. If any arguments are given, they will be joined to the end of the servolux base path using File.join.

Returns:

  • (String)

    absolute servolux base path



36
37
38
# File 'lib/servolux.rb', line 36

def self.path( *args )
  args.empty? ? PATH : ::File.join(PATH, args.flatten)
end

.versionString

Returns the version string for the library.

Returns:

  • (String)


16
17
18
# File 'lib/servolux.rb', line 16

def self.version
  @version ||= File.read(path('version.txt')).strip
end