Class: Rpush::Deprecation

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

Class Method Summary collapse

Class Method Details

.mutedObject



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

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

.muted?Boolean

Returns:

  • (Boolean)


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

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

.warn(msg) ⇒ Object



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

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