Class: RMonitor::DSLHelpers::ProfileBuilder
- Inherits:
-
Object
- Object
- RMonitor::DSLHelpers::ProfileBuilder
- Defined in:
- lib/rmonitor/helpers/dsl_helpers.rb
Instance Attribute Summary collapse
-
#profiles ⇒ Object
Returns the value of attribute profiles.
Instance Method Summary collapse
-
#initialize ⇒ ProfileBuilder
constructor
A new instance of ProfileBuilder.
- #profile(name, options = {}, &block) ⇒ Object
Constructor Details
#initialize ⇒ ProfileBuilder
Returns a new instance of ProfileBuilder.
6 7 8 |
# File 'lib/rmonitor/helpers/dsl_helpers.rb', line 6 def initialize @profiles = [] end |
Instance Attribute Details
#profiles ⇒ Object
Returns the value of attribute profiles.
4 5 6 |
# File 'lib/rmonitor/helpers/dsl_helpers.rb', line 4 def profiles @profiles end |
Instance Method Details
#profile(name, options = {}, &block) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/rmonitor/helpers/dsl_helpers.rb', line 10 def profile(name, = {}, &block) device_builder = DeviceBuilder.new device_builder.instance_eval(&block) if [:only_if] [:only_if] = method([:only_if]) elsif [:not_if] [:not_if] = method([:not_if]) end @profiles << { :name => name, :options => , :devices => device_builder.devices } end |