Class: Radiosonde::Wrapper::AlarmCollection
- Inherits:
-
Object
- Object
- Radiosonde::Wrapper::AlarmCollection
- Includes:
- Logger::Helper
- Defined in:
- lib/radiosonde/wrapper/alarm_collection.rb
Instance Method Summary collapse
- #create(name, dsl) ⇒ Object
- #each ⇒ Object
-
#initialize(cloud_watch, alarms, options = {}) ⇒ AlarmCollection
constructor
A new instance of AlarmCollection.
Methods included from Logger::Helper
Constructor Details
#initialize(cloud_watch, alarms, options = {}) ⇒ AlarmCollection
Returns a new instance of AlarmCollection.
4 5 6 7 8 |
# File 'lib/radiosonde/wrapper/alarm_collection.rb', line 4 def initialize(cloud_watch, alarms, = {}) @cloud_watch = cloud_watch @alarms = alarms @options = end |
Instance Method Details
#create(name, dsl) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/radiosonde/wrapper/alarm_collection.rb', line 16 def create(name, dsl) log(:info, 'Create Alarm', :cyan, name) opts = Radiosonde::Wrapper::Alarm.normalize_attrs(dsl) if @options[:dry_run] alarm = OpenStruct.new(opts.merge(:alarm_name => name)) else alarm = @alarms.create(name, opts) @cloud_watch.modify! end Radiosonde::Wrapper::Alarm.new(@cloud_watch, alarm, @options) end |
#each ⇒ Object
10 11 12 13 14 |
# File 'lib/radiosonde/wrapper/alarm_collection.rb', line 10 def each @alarms.each do |alarm| yield(Radiosonde::Wrapper::Alarm.new(@cloud_watch, alarm, @options)) end end |