Class: SetVibrateAction

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 = {}) ⇒ SetVibrateAction

Returns a new instance of SetVibrateAction.



2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
# File 'lib/ruby-macrodroid/actions.rb', line 2241

def initialize(h={})

  options = {
    option: 'Silent (Vibrate On)',
    option_int: -1
  }

  super(options.merge h)

end

Instance Method Details

#to_s(colour: false) ⇒ Object



2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
# File 'lib/ruby-macrodroid/actions.rb', line 2252

def to_s(colour: false)
  
  a = [
    'Silent (Vibrate On)',
    'Normal (Vibrate Off)',
    'Vibrate when ringing On',
    'Vibrate when ringing Off',
    'Vibrate when ringing Toggle'
  ]
  
  status = a[@h[:option_int]]
  @s = 'Vibrate Enable/Disable ' + "\n    " + status + "\n  "
  super()
  
end

#to_summary(colour: false) ⇒ Object



2268
2269
2270
2271
2272
# File 'lib/ruby-macrodroid/actions.rb', line 2268

def to_summary(colour: false)
  
  @s = 'Vibrate Enable/Disable'
  
end