Class: VibrateAction
- Inherits:
-
DeviceSettingsAction
- Object
- MacroObject
- Action
- DeviceSettingsAction
- VibrateAction
- Defined in:
- lib/ruby-macrodroid/actions.rb
Overview
Category: Device Settings
Instance Attribute Summary
Attributes inherited from Action
Attributes inherited from MacroObject
Instance Method Summary collapse
-
#initialize(h = {}) ⇒ VibrateAction
constructor
A new instance of VibrateAction.
- #to_s(colour: false, indent: 0) ⇒ Object
Methods inherited from Action
Methods included from ObjectX
#action_to_object, #object_create, #varify
Methods inherited from MacroObject
Constructor Details
#initialize(h = {}) ⇒ VibrateAction
Returns a new instance of VibrateAction.
1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 |
# File 'lib/ruby-macrodroid/actions.rb', line 1195 def initialize(h={}) pattern = [ 'Blip', 'Short Buzz', 'Long Buzz', 'Rapid', 'Slow', 'Increasing', 'Constant', 'Decreasing', 'Final Fantasy', 'Game Over', 'Star Wars', 'Mini Blip', 'Micro Blip' ] if h[:pattern] then h[:vibrate_pattern] = pattern.map(&:downcase).index h[:pattern] end = { vibrate_pattern: 1 } super(.merge h) end |
Instance Method Details
#to_s(colour: false, indent: 0) ⇒ Object
1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 |
# File 'lib/ruby-macrodroid/actions.rb', line 1215 def to_s(colour: false, indent: 0) pattern = [ 'Blip', 'Short Buzz', 'Long Buzz', 'Rapid', 'Slow', 'Increasing', 'Constant', 'Decreasing', 'Final Fantasy', 'Game Over', 'Star Wars', 'Mini Blip', 'Micro Blip' ] 'Vibrate ' + "(%s)" % pattern[@h[:vibrate_pattern].to_i] end |