Class: VolumeButtonTrigger
- Inherits:
-
Trigger
- Object
- MacroObject
- Trigger
- VolumeButtonTrigger
- Defined in:
- lib/ruby-macrodroid/triggers.rb
Overview
Category: User Input
Instance Attribute Summary
Attributes inherited from Trigger
Attributes inherited from MacroObject
Instance Method Summary collapse
-
#initialize(h = {}) ⇒ VolumeButtonTrigger
constructor
A new instance of VolumeButtonTrigger.
- #to_s(colour: false) ⇒ Object
- #to_summary(colour: false) ⇒ Object
Methods inherited from Trigger
Methods inherited from MacroObject
Constructor Details
#initialize(h = {}) ⇒ VolumeButtonTrigger
Returns a new instance of VolumeButtonTrigger.
1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 |
# File 'lib/ruby-macrodroid/triggers.rb', line 1521 def initialize(h={}) = { dont_change_volume: true, monitor_option: 1, not_configured: false, option: 0 } super(.merge h) end |
Instance Method Details
#to_s(colour: false) ⇒ Object
1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 |
# File 'lib/ruby-macrodroid/triggers.rb', line 1534 def to_s(colour: false) a = [ 'Volume Up', 'Volume Down', 'Volume Up - Long Press', 'Volume Down - Long Press' ] lines = [a[@h[:option]]] lines << ' ' + (@h[:dont_change_volume] ? 'Retain Previous Volume' : 'Update Volume') @s = lines.join("\n") end |
#to_summary(colour: false) ⇒ Object
1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 |
# File 'lib/ruby-macrodroid/triggers.rb', line 1548 def to_summary(colour: false) a = [ 'Volume Up', 'Volume Down', 'Volume Up - Long Press', 'Volume Down - Long Press' ] lines = [a[@h[:option]]] lines << (@h[:dont_change_volume] ? 'Retain Previous Volume' : 'Update Volume') @s = lines.join(": ") end |