Module: Postmark::Deprecations

Defined in:
lib/postmark/deprecations.rb

Constant Summary collapse

DEFAULT_BEHAVIORS =
{
  :raise => lambda { |message| raise message },
  :log => lambda { |message| warn message },
  :silence => lambda { |message| },
}

Class Method Summary collapse

Class Method Details

.add_constants(mappings) ⇒ Object



31
32
33
# File 'lib/postmark/deprecations.rb', line 31

def self.add_constants(mappings)
  deprecated_constants.merge!(mappings)
end

.behaviorObject



23
24
25
# File 'lib/postmark/deprecations.rb', line 23

def self.behavior
  @behavior ||= :log
end

.behavior=(behavior) ⇒ Object



27
28
29
# File 'lib/postmark/deprecations.rb', line 27

def self.behavior=(behavior)
  @behavior = behavior
end

.deprecated_constantsObject



19
20
21
# File 'lib/postmark/deprecations.rb', line 19

def self.deprecated_constants
  @deprecated_constants ||= {}
end

.report(message) ⇒ Object



15
16
17
# File 'lib/postmark/deprecations.rb', line 15

def self.report(message)
  DEFAULT_BEHAVIORS.fetch(behavior).call(message)
end