Module: Rookout::UserWarnings

Defined in:
lib/rookout/user_warnings.rb

Constant Summary collapse

TLS_KEY =
:ROOKOUT_USER_WARNINGS

Class Method Summary collapse

Class Method Details

.notify_error(error) ⇒ Object



20
21
22
23
# File 'lib/rookout/user_warnings.rb', line 20

def notify_error error
  aug = Thread.current[TLS_KEY]
  aug.notify_error error unless aug.nil?
end

.notify_warning(error) ⇒ Object



15
16
17
18
# File 'lib/rookout/user_warnings.rb', line 15

def notify_warning error
  aug = Thread.current[TLS_KEY]
  aug.notify_warning error unless aug.nil?
end

.with(aug, &block) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/rookout/user_warnings.rb', line 5

def with aug, &block
  thread = Thread.current
  begin
    thread[TLS_KEY] = aug
    block.call
  ensure
    thread[:ROOKOUT_USER_WARNINGS] = nil
  end
end