Class: Rapns::Deprecation

Inherits:
Object
  • Object
show all
Defined in:
lib/rapns/deprecation.rb

Class Method Summary collapse

Class Method Details

.mutedObject



3
4
5
6
7
8
9
10
11
# File 'lib/rapns/deprecation.rb', line 3

def self.muted
  begin
    orig_val = Thread.current[:rapns_mute_deprecations]
    Thread.current[:rapns_mute_deprecations] = true
    yield
  ensure
    Thread.current[:rapns_mute_deprecations] = orig_val
  end
end

.muted?Boolean



13
14
15
# File 'lib/rapns/deprecation.rb', line 13

def self.muted?
  Thread.current[:rapns_mute_deprecations] == true
end

.warn(msg) ⇒ Object



17
18
19
20
21
# File 'lib/rapns/deprecation.rb', line 17

def self.warn(msg)
  unless Rapns::Deprecation.muted?
    STDERR.puts "DEPRECATION WARNING: #{msg}"
  end
end