Class: WatchList::DSL::Context::Monitor::Type

Inherits:
Object
  • Object
show all
Defined in:
lib/watch_list/dsl/context/monitor/type.rb

Direct Known Subclasses

HTTP, Ping, Port

Constant Summary collapse

CHILDREN =
{}

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(monitor_name, &block) ⇒ Type

of class methods



15
16
17
18
19
# File 'lib/watch_list/dsl/context/monitor/type.rb', line 15

def initialize(monitor_name, &block)
  @monitor_name = monitor_name
  @result = {}
  instance_eval(&block) if block
end

Class Method Details

.[](name) ⇒ Object



10
11
12
# File 'lib/watch_list/dsl/context/monitor/type.rb', line 10

def [](name)
  CHILDREN[name]
end

.inherited(child) ⇒ Object



5
6
7
8
# File 'lib/watch_list/dsl/context/monitor/type.rb', line 5

def inherited(child)
  name = child.to_s.split('::').last.downcase
  CHILDREN[name] = child
end

Instance Method Details

#resultObject



21
22
23
# File 'lib/watch_list/dsl/context/monitor/type.rb', line 21

def result
  @result
end