Class: Rbcli::DeprecationWarning

Inherits:
Object
  • Object
show all
Defined in:
lib/rbcli/util/deprecation_warning.rb

Constant Summary collapse

@@warnings =
[]

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(original_feature_name, message_text, change_by_version) ⇒ DeprecationWarning

Returns a new instance of DeprecationWarning.



26
27
28
29
30
31
32
# File 'lib/rbcli/util/deprecation_warning.rb', line 26

def initialize original_feature_name, message_text, change_by_version
  #@caller = caller_locations(2,1)[0].label
  @original_feature_name = original_feature_name
  @message_text = message_text
  @change_by_version = change_by_version
  @@warnings.append self
end

Class Method Details

.display_warningsObject



40
41
42
# File 'lib/rbcli/util/deprecation_warning.rb', line 40

def self.display_warnings
  @@warnings.each { |w| w.display }
end

Instance Method Details

#displayObject



34
35
36
37
38
# File 'lib/rbcli/util/deprecation_warning.rb', line 34

def display
  message = "DEPRECATION WRNING: The feature `#{@original_feature_name}` has been deprecated. #{@message_text} This feature will be removed in version #{@change_by_version}."
  Rbcli::log.warn { message }
  puts message.red
end