Class: ProximitySensorConstraint

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 = {}) ⇒ ProximitySensorConstraint

Returns a new instance of ProximitySensorConstraint.



1355
1356
1357
1358
1359
1360
1361
1362
1363
# File 'lib/ruby-macrodroid/constraints.rb', line 1355

def initialize(h={})

  options = {
    near: true
  }

  super(options.merge h)

end

Instance Method Details

#to_s(colour: false, indent: 0) ⇒ Object



1365
1366
1367
# File 'lib/ruby-macrodroid/constraints.rb', line 1365

def to_s(colour: false, indent: 0)
  'Proximity Sensor: ' + (@h[:near] ? 'Near' : 'Far')
end