Class: SetVolumeAction

Inherits:
VolumeAction show all
Defined in:
lib/ruby-macrodroid/actions.rb

Overview

Category: Volume

Instance Attribute Summary

Attributes inherited from Action

#constraints

Attributes inherited from MacroObject

#options, #siguid, #type

Instance Method Summary collapse

Methods inherited from Action

#invoke

Methods inherited from MacroObject

#to_h

Constructor Details

#initialize(h = {}) ⇒ SetVolumeAction

Returns a new instance of SetVolumeAction.



2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
# File 'lib/ruby-macrodroid/actions.rb', line 2322

def initialize(h={})

  options = {
    variables: [nil, nil, nil, nil, nil, nil, nil],
    stream_index_array: [false, false, false, false, false, false, true],
    stream_volume_array: [0, 0, 0, 0, 0, 0, 66],
    force_vibrate_off: false,
    volume: -1
  }

  super(options.merge h)

end

Instance Method Details

#to_s(colour: false) ⇒ Object



2336
2337
2338
2339
# File 'lib/ruby-macrodroid/actions.rb', line 2336

def to_s(colour: false)
  volume = @h[:stream_index_array].zip(@h[:stream_volume_array]).to_h[true]
  'Volume Change ' + "Notification = %s%%" % volume    
end