Module: Mainline

Defined in:
lib/mainline.rb,
lib/mainline/core.rb,
lib/mainline/config.rb,
lib/mainline/server.rb,
lib/mainline/nil_server.rb

Defined Under Namespace

Classes: Config, Core, NilServer, Server

Constant Summary collapse

VERSION =
"1.0.1"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.configurationObject

:nodoc:



14
15
16
# File 'lib/mainline/core.rb', line 14

def self.configuration # :nodoc:
  defined?(@@configuration) ? @@configuration : nil
end

.enable(configuration = Mainline.configuration) {|configuration| ... } ⇒ Object

Configures Mainline. If this is not done, Mainline will not be activated

Yields:



8
9
10
11
12
# File 'lib/mainline/core.rb', line 8

def self.enable(configuration = Mainline.configuration)
  configuration ||= Mainline::Config.new
  yield configuration if block_given?
  @@configuration = configuration
end

Instance Method Details

#initializeObject



11
12
13
# File 'lib/mainline.rb', line 11

def initialize()
  @started = false
end

#startObject



15
16
17
18
19
20
21
22
# File 'lib/mainline.rb', line 15

def start
  return if @started
  Thread.new do
    @server = Mainline::Server.new(@config)
    @server.start
  end
  @started = true
end