Class: GeofenceTrigger
- Inherits:
-
Trigger
- Object
- MacroObject
- Trigger
- GeofenceTrigger
- Defined in:
- lib/ruby-macrodroid.rb
Overview
Category: Location
Instance Attribute Summary
Attributes inherited from Trigger
Attributes inherited from MacroObject
Instance Method Summary collapse
-
#initialize(h = {}, geofences: {}) ⇒ GeofenceTrigger
constructor
A new instance of GeofenceTrigger.
- #to_s(colour: false) ⇒ Object
Methods inherited from Trigger
Methods inherited from MacroObject
Constructor Details
#initialize(h = {}, geofences: {}) ⇒ GeofenceTrigger
Returns a new instance of GeofenceTrigger.
2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 |
# File 'lib/ruby-macrodroid.rb', line 2403 def initialize( h={}, geofences: {}) if h[:name] then puts ('geofences2: ' + geofences.inspect) if $debug found = geofences.find {|x| x.name.downcase == h[:name].downcase} h[:geofence_id] = found.id if found end = { update_rate_text: '5 Minutes', geofence_id: '', geofence_update_rate_minutes: 5, trigger_from_unknown: false, enter_area: true } super(.merge filter(, h)) @geofences = geofences end |
Instance Method Details
#to_s(colour: false) ⇒ Object
2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 |
# File 'lib/ruby-macrodroid.rb', line 2425 def to_s(colour: false) if $debug then puts ' @geofences: ' + @geofences.inspect puts '@h: ' + @h.inspect puts '@h[:geofence_id]: ' + @h[:geofence_id].inspect end direction = @h[:enter_area] ? 'Entry' : 'Exit' found = @geofences.find {|x| x.id == @h[:geofence_id]} puts 'found: ' + found.inspect if @debug label = found ? found.name : 'error: name not found' "Geofence %s (%s)" % [direction, label] end |