Class: FlipDeviceTrigger
- Inherits:
-
SensorsTrigger
- Object
- MacroObject
- Trigger
- SensorsTrigger
- FlipDeviceTrigger
- Defined in:
- lib/ruby-macrodroid/triggers.rb
Overview
Category: Sensors
options:
Face Up -> Face Down
Face Down -> Face Up
Any -> Face Down
Instance Attribute Summary
Attributes inherited from Trigger
Attributes inherited from MacroObject
Instance Method Summary collapse
-
#initialize(h = {}) ⇒ FlipDeviceTrigger
constructor
A new instance of FlipDeviceTrigger.
- #match?(detail = {}) ⇒ Boolean
- #to_pc ⇒ Object
- #to_s(colour: false) ⇒ Object
Methods inherited from MacroObject
Constructor Details
#initialize(h = {}) ⇒ FlipDeviceTrigger
Returns a new instance of FlipDeviceTrigger.
1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 |
# File 'lib/ruby-macrodroid/triggers.rb', line 1535 def initialize(h={}) = { any_start: false, face_down: true, work_with_screen_off: false } super(.merge h) end |
Instance Method Details
#match?(detail = {}) ⇒ Boolean
1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 |
# File 'lib/ruby-macrodroid/triggers.rb', line 1547 def match?(detail={}) fd = detail[:face_down] b = if fd.is_a? String then fd.downcase == 'true' else fd end @h[:face_down] == b end |
#to_pc ⇒ Object
1560 1561 1562 |
# File 'lib/ruby-macrodroid/triggers.rb', line 1560 def to_pc() @h[:face_down] ? 'flip_device_down?' : 'flip_device_up?' end |
#to_s(colour: false) ⇒ Object
1564 1565 1566 1567 1568 |
# File 'lib/ruby-macrodroid/triggers.rb', line 1564 def to_s(colour: false) action = @h[:face_down] ? 'Face Up -> Face Down' : 'Face Down -> Face Up' 'Flip Device ' + action end |