Class: ProximityTrigger
- Inherits:
-
SensorsTrigger
- Object
- MacroObject
- Trigger
- SensorsTrigger
- ProximityTrigger
- Defined in:
- lib/ruby-macrodroid.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
Methods inherited from Trigger
Methods inherited from MacroObject
Constructor Details
#initialize(h = {}) ⇒ ProximityTrigger
Returns a new instance of ProximityTrigger.
2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 |
# File 'lib/ruby-macrodroid.rb', line 2518 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 filter(,h)) end |
Instance Method Details
#to_s(colour: false) ⇒ Object
2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 |
# File 'lib/ruby-macrodroid.rb', line 2537 def to_s(colour: false) distance = if @h[:near] then 'Near' else 'Far' end "Proximity Sensor (%s)" % distance end |