class Rookout::Augs::Locations::Location
Public Class Methods
new(output, aug)
click to toggle source
# File lib/rookout/augs/locations/location.rb, line 9 def initialize output, aug @output = output @aug = aug @log_cache = [] end
Public Instance Methods
add_aug(_trigger_services)
click to toggle source
# File lib/rookout/augs/locations/location.rb, line 15 def add_aug _trigger_services raise NotImplementedError end
execute(frame, extracted)
click to toggle source
# File lib/rookout/augs/locations/location.rb, line 23 def execute frame, extracted UserWarnings.with self do begin @aug.execute frame, extracted, @output rescue SystemExit raise rescue Exception => e message = "Exception while processing Aug" error = Processor::RookError.new e, message notify_warning error end end end
id()
click to toggle source
# File lib/rookout/augs/locations/location.rb, line 19 def id @aug.id end
notify_active()
click to toggle source
# File lib/rookout/augs/locations/location.rb, line 37 def notify_active send_rule_status :Active end
notify_error(error)
click to toggle source
# File lib/rookout/augs/locations/location.rb, line 49 def notify_error error send_rule_status :Error, error end
notify_pending()
click to toggle source
# File lib/rookout/augs/locations/location.rb, line 41 def notify_pending send_rule_status :Pending end
notify_removed()
click to toggle source
# File lib/rookout/augs/locations/location.rb, line 45 def notify_removed send_rule_status :Deleted end
notify_warning(error)
click to toggle source
# File lib/rookout/augs/locations/location.rb, line 53 def notify_warning error return if silence_log? error Logger.instance.warning error.message # For easier testing return if @output.nil? @output.send_rule_status id, :Warning, error end
Private Instance Methods
send_rule_status(status, error = nil)
click to toggle source
# File lib/rookout/augs/locations/location.rb, line 72 def send_rule_status status, error = nil return if @status == status Logger.instance.info "Updating rule status for #{@id} to #{status}" @status = status # For easier testing return if @output.nil? @output.send_rule_status id, status, error end
silence_log?(error)
click to toggle source
# File lib/rookout/augs/locations/location.rb, line 65 def silence_log? error return true if @log_cache.length >= MAX_LOG_CACHE_SIZE || @log_cache.include?(error.message) @log_cache << error.message false end