Class: Rookout::Augs::Locations::Location

Inherits:
Object
  • Object
show all
Defined in:
lib/rookout/augs/locations/location.rb

Direct Known Subclasses

LocationExceptionHandler, LocationFileLine

Instance Method Summary collapse

Constructor Details

#initialize(output, aug) ⇒ Location

Returns a new instance of Location.



9
10
11
12
13
# File 'lib/rookout/augs/locations/location.rb', line 9

def initialize output, aug
  @output = output
  @aug = aug
  @log_cache = []
end

Instance Method Details

#add_aug(_trigger_services) ⇒ Object

Raises:

  • (NotImplementedError)


15
16
17
# File 'lib/rookout/augs/locations/location.rb', line 15

def add_aug _trigger_services
  raise NotImplementedError
end

#execute(frame_binding, stack_trace, extracted) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/rookout/augs/locations/location.rb', line 23

def execute frame_binding, stack_trace, extracted
  UserWarnings.with self do
    begin
      @aug.execute frame_binding, stack_trace, 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

#idObject



19
20
21
# File 'lib/rookout/augs/locations/location.rb', line 19

def id
  @aug.id
end

#notify_activeObject



37
38
39
# File 'lib/rookout/augs/locations/location.rb', line 37

def notify_active
  send_rule_status :Active
end

#notify_error(error) ⇒ Object



49
50
51
# File 'lib/rookout/augs/locations/location.rb', line 49

def notify_error error
  send_rule_status :Error, error
end

#notify_pendingObject



41
42
43
# File 'lib/rookout/augs/locations/location.rb', line 41

def notify_pending
  send_rule_status :Pending
end

#notify_removedObject



45
46
47
# File 'lib/rookout/augs/locations/location.rb', line 45

def notify_removed
  send_rule_status :Deleted
end

#notify_warning(error) ⇒ Object



53
54
55
56
57
58
59
60
61
# File 'lib/rookout/augs/locations/location.rb', line 53

def notify_warning error
  return if silence_log? error

  Logger.instance.warning error.message, error.exception

  # For easier testing
  return if @output.nil?
  @output.send_rule_status id, :Warning, error
end