Class: Chef::Deprecated::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/chef/deprecated.rb

Constant Summary collapse

BASE_URL =
"https://docs.chef.io/deprecations_"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(msg = nil, location = nil) ⇒ Base

Returns a new instance of Base


37
38
39
40
# File 'lib/chef/deprecated.rb', line 37

def initialize(msg = nil, location = nil)
  @message = msg if msg
  @location = location if location
end

Instance Attribute Details

#locationObject

Returns the value of attribute location


35
36
37
# File 'lib/chef/deprecated.rb', line 35

def location
  @location
end

#messageObject

Returns the value of attribute message


35
36
37
# File 'lib/chef/deprecated.rb', line 35

def message
  @message
end

Instance Method Details

#<<(location) ⇒ Object

We know that the only time this gets called is by Chef::Log.deprecation, so special case


52
53
54
# File 'lib/chef/deprecated.rb', line 52

def <<(location)
  @location = location
end

#idObject

Raises:

  • (NotImplementedError)

60
61
62
# File 'lib/chef/deprecated.rb', line 60

def id
  raise NotImplementedError, "subclasses of Chef::Deprecated::Base should define #id with a unique number"
end

#inspectObject


56
57
58
# File 'lib/chef/deprecated.rb', line 56

def inspect
  "#{message} (CHEF-#{id})#{location}.\n#{link}"
end

42
43
44
# File 'lib/chef/deprecated.rb', line 42

def link
  "Please see #{url} for further details and information on how to correct this problem."
end

#targetObject

Raises:

  • (NotImplementedError)

64
65
66
# File 'lib/chef/deprecated.rb', line 64

def target
  raise NotImplementedError, "subclasses of Chef::Deprecated::Base should define #target"
end

#urlObject


46
47
48
# File 'lib/chef/deprecated.rb', line 46

def url
  "#{BASE_URL}#{target}"
end