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 ⇒ Object
Methods inherited from Trigger
Methods inherited from MacroObject
Constructor Details
#initialize(h = {}) ⇒ ProximityTrigger
Returns a new instance of ProximityTrigger.
2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 |
# File 'lib/ruby-macrodroid.rb', line 2270 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 ⇒ Object
2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 |
# File 'lib/ruby-macrodroid.rb', line 2289 def to_s() distance = if @h[:near] then 'Near' else 'Far' end "Proximity Sensor (%s)" % distance end |