Class: FaceUpDownConstraint

Inherits:
Constraint show all
Defined in:
lib/ruby-macrodroid/constraints.rb

Overview

Category: Sensors

Instance Attribute Summary

Attributes inherited from MacroObject

#options, #siguid, #type

Instance Method Summary collapse

Methods inherited from Constraint

#match?

Methods inherited from MacroObject

#to_h

Constructor Details

#initialize(h = {}) ⇒ FaceUpDownConstraint

Returns a new instance of FaceUpDownConstraint.



1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
# File 'lib/ruby-macrodroid/constraints.rb', line 1282

def initialize(h={})

  options = {
    option: -1,
    selected_options: [true, false, true, false, false, false]
  }

  super(options.merge h)

end

Instance Method Details

#to_s(colour: false, indent: 0) ⇒ Object Also known as: to_summary



1293
1294
1295
1296
1297
1298
1299
# File 'lib/ruby-macrodroid/constraints.rb', line 1293

def to_s(colour: false, indent: 0)
  a = ['Face Up', 'Face Down', 'Vertical Upright', 'Vertical Upside Down', 
       'Sideways Left', 'Sideways Right']
  s = @h[:selected_options].zip(a).select(&:first).map(&:last).join(', ')

  'Device Facing' + "\n  " + s #+ @h.inspect
end