Class: ProximityTrigger
- Inherits:
-
SensorsTrigger
- Object
- MacroObject
- Trigger
- SensorsTrigger
- ProximityTrigger
- Defined in:
- lib/ruby-macrodroid/triggers.rb
Overview
Category: Sensors
Instance Attribute Summary
Attributes inherited from Trigger
Attributes inherited from MacroObject
Instance Method Summary collapse
-
#initialize(h = {}) ⇒ ProximityTrigger
constructor
A new instance of ProximityTrigger.
- #to_s(colour: false) ⇒ Object (also: #to_summary)
Methods inherited from Trigger
Methods inherited from MacroObject
Constructor Details
#initialize(h = {}) ⇒ ProximityTrigger
Returns a new instance of ProximityTrigger.
1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 |
# File 'lib/ruby-macrodroid/triggers.rb', line 1307 def initialize(h={}) if h[:distance] then case h[:distance].to_sym when :near [:near] = true end end = { near: true, selected_option: 0 } super(.merge h) end |
Instance Method Details
#to_s(colour: false) ⇒ Object Also known as: to_summary
1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 |
# File 'lib/ruby-macrodroid/triggers.rb', line 1326 def to_s(colour: false) distance = if @h[:near] then 'Near' else 'Far' end "Proximity Sensor (%s)" % distance end |