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.



1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
# File 'lib/ruby-macrodroid/actions.rb', line 1957

def initialize(h={})

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

  super(options.merge h)

end

Instance Method Details

#to_s(colour: false) ⇒ Object



1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
# File 'lib/ruby-macrodroid/actions.rb', line 1968

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



1984
1985
1986
1987
1988
# File 'lib/ruby-macrodroid/actions.rb', line 1984

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