Class: WatchList::DSL::Context::Monitor::Port
- Inherits:
-
Type
- Object
- Type
- WatchList::DSL::Context::Monitor::Port
show all
- Defined in:
- lib/watch_list/dsl/context/monitor/port.rb
Constant Summary
Constants inherited
from Type
Type::CHILDREN
Instance Method Summary
collapse
Methods inherited from Type
[], inherited, #initialize
Instance Method Details
#port(value) ⇒ Object
25
26
27
28
|
# File 'lib/watch_list/dsl/context/monitor/port.rb', line 25
def port(value)
raise %!Monitor `#{@monitor_name}`: "port" is invalid: #{value.inspect}! unless value.kind_of?(Integer)
@result[:Port] = value
end
|
#result ⇒ Object
3
4
5
6
7
8
9
|
# File 'lib/watch_list/dsl/context/monitor/port.rb', line 3
def result
[:SubType, :Port].each do |key|
raise %!Monitor `#{@monitor_name}`: "#{key.to_s.downcase}" is required! unless @result[key]
end
super
end
|
#subtype(value) ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/watch_list/dsl/context/monitor/port.rb', line 11
def subtype(value)
if value.kind_of?(Integer)
type = value
else
type = WatchList::Monitor::SubType[value.to_s]
end
unless WatchList::Monitor::SubType.values.include?(type)
raise %!Monitor `#{@monitor_name}`: "subtype" is invalid: #{value.inspect}!
end
@result[:SubType] = type
end
|