Class: RMonitor::Config::DSL

Inherits:
Object
  • Object
show all
Defined in:
lib/rmonitor/config/dsl.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDSL

Returns a new instance of DSL.



8
9
10
# File 'lib/rmonitor/config/dsl.rb', line 8

def initialize
  @profiles = []
end

Instance Attribute Details

#profilesObject

Returns the value of attribute profiles.



6
7
8
# File 'lib/rmonitor/config/dsl.rb', line 6

def profiles
  @profiles
end

Instance Method Details

#profile(name, options = {}, &block) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/rmonitor/config/dsl.rb', line 12

def profile(name, options = {}, &block)
  @profiles << RMonitor::Profile::Builder.define(name, options, &block)

  if @profiles.last.has_key?(:only_if)
    @profiles.last[:only_if] = method(@profiles.last[:only_if])
  end

  if @profiles.last.has_key?(:not_if)
    @profiles.last[:not_if] = method(@profiles.last[:not_if])
  end
end