Class: FlipDeviceTrigger

Inherits:
SensorsTrigger show all
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

#constraints

Attributes inherited from MacroObject

#options, #siguid, #type

Instance Method Summary collapse

Methods inherited from Trigger

#match?

Methods inherited from MacroObject

#to_h

Constructor Details

#initialize(h = {}) ⇒ FlipDeviceTrigger

Returns a new instance of FlipDeviceTrigger.



1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
# File 'lib/ruby-macrodroid/triggers.rb', line 1485

def initialize(h={})

  options = {
    any_start: false,
    face_down: true,
    work_with_screen_off: false
  }

  super(options.merge h)

end

Instance Method Details

#to_pcObject



1497
1498
1499
# File 'lib/ruby-macrodroid/triggers.rb', line 1497

def to_pc()
  @h[:face_down] ? 'flip_device_down?' : 'flip_device_up?'
end

#to_s(colour: false) ⇒ Object



1501
1502
1503
1504
1505
# File 'lib/ruby-macrodroid/triggers.rb', line 1501

def to_s(colour: false)
  
  action = @h[:face_down] ? 'Face Up -> Face Down' : 'Face Down -> Face Up'
  'Flip Device ' + action
end