class FlipDeviceTrigger

Category: Sensors

options:

Face Up -> Face Down
Face Down -> Face Up
Any -> Face Down

Public Class Methods

new(h={}) click to toggle source
Calls superclass method SensorsTrigger::new
# File lib/ruby-macrodroid/triggers.rb, line 1539
def initialize(h={})

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

  super(options.merge h)

end

Public Instance Methods

match?(detail={}) click to toggle source
# File lib/ruby-macrodroid/triggers.rb, line 1551
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() click to toggle source
# File lib/ruby-macrodroid/triggers.rb, line 1564
def to_pc()
  @h[:face_down] ? 'flip_device_down?' : 'flip_device_up?'
end
to_s(colour: false) click to toggle source
# File lib/ruby-macrodroid/triggers.rb, line 1568
def to_s(colour: false)
  
  action = @h[:face_down] ? 'Face Up -> Face Down' : 'Face Down -> Face Up'
  'Flip Device ' + action
end