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.



1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
# File 'lib/ruby-macrodroid/constraints.rb', line 1271

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



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

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