Class: DNS::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/faildns/server.rb,
lib/faildns/server/dispatcher.rb,
lib/faildns/server/dispatcher/event.rb,
lib/faildns/server/dispatcher/socket.rb,
lib/faildns/server/dispatcher/eventdispatcher.rb,
lib/faildns/server/dispatcher/connectiondispatcher.rb

Defined Under Namespace

Classes: Dispatcher

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Server

Returns a new instance of Server.



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/faildns/server.rb', line 28

def initialize (options={})
  if !options.is_a? Hash
    raise ArgumentError.new('You have to pass a Hash')
  end

  @options = options

  @dispatcher = Dispatcher.new(self)

  if block_given?
    yield self
  end
end

Instance Attribute Details

#dispatcherObject (readonly)

Returns the value of attribute dispatcher.



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

def dispatcher
  @dispatcher
end

#optionsObject (readonly)

Returns the value of attribute options.



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

def options
  @options
end

Instance Method Details

#fire(*args) ⇒ Object



66
67
68
# File 'lib/faildns/server.rb', line 66

def fire (*args)
  @dispatcher.event.fire(*args)
end

#observe(*args) ⇒ Object



62
63
64
# File 'lib/faildns/server.rb', line 62

def observe (*args)
  @dispatcher.event.observe(*args)
end

#register(*args) ⇒ Object



58
59
60
# File 'lib/faildns/server.rb', line 58

def register (*args)
  @dispatcher.event.register(*args)
end

#startObject



42
43
44
45
46
47
48
49
50
# File 'lib/faildns/server.rb', line 42

def start
  if @started
    return
  end

  @started = true

  @dispatcher.start
end

#stoppingObject



52
53
54
55
56
# File 'lib/faildns/server.rb', line 52

def stopping
  @stopping = true

  @dispatcher.stop
end