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 ⇒ Object
Methods inherited from Trigger
Methods inherited from MacroObject
Constructor Details
#initialize(h = {}, geofences: {}) ⇒ GeofenceTrigger
Returns a new instance of GeofenceTrigger.
2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 |
# File 'lib/ruby-macrodroid.rb', line 2076 def initialize( h={}, geofences: {}) if h[:name] then puts ('geofences2: ' + geofences.inspect) 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 ⇒ Object
2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 |
# File 'lib/ruby-macrodroid.rb', line 2098 def to_s() 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 |