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.
2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 |
# File 'lib/ruby-macrodroid.rb', line 2160 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 ⇒ Object
2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 |
# File 'lib/ruby-macrodroid.rb', line 2182 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 |