Class: RMonitor::Config::DSL
- Inherits:
-
Object
- Object
- RMonitor::Config::DSL
- Defined in:
- lib/rmonitor/config/dsl.rb
Instance Attribute Summary collapse
-
#profiles ⇒ Object
Returns the value of attribute profiles.
Instance Method Summary collapse
-
#initialize ⇒ DSL
constructor
A new instance of DSL.
- #profile(name, options = {}, &block) ⇒ Object
Constructor Details
#initialize ⇒ DSL
Returns a new instance of DSL.
8 9 10 |
# File 'lib/rmonitor/config/dsl.rb', line 8 def initialize @profiles = [] end |
Instance Attribute Details
#profiles ⇒ Object
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, = {}, &block) @profiles << RMonitor::Profile::Builder.define(name, , &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 |