Class: Inspec::Deprecation::Deprecator
- Inherits:
-
Object
- Object
- Inspec::Deprecation::Deprecator
- Defined in:
- lib/inspec/utils/deprecation/deprecator.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#groups ⇒ Object
readonly
Returns the value of attribute groups.
Instance Method Summary collapse
- #handle_deprecation(group_name, message, opts = {}) ⇒ Object
-
#initialize(opts = {}) ⇒ Deprecator
constructor
A new instance of Deprecator.
Constructor Details
#initialize(opts = {}) ⇒ Deprecator
Returns a new instance of Deprecator.
9 10 11 12 |
# File 'lib/inspec/utils/deprecation/deprecator.rb', line 9 def initialize(opts = {}) @config = Inspec::Deprecation::ConfigFile.new(opts[:config_io]) @groups = @config.groups end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
7 8 9 |
# File 'lib/inspec/utils/deprecation/deprecator.rb', line 7 def config @config end |
#groups ⇒ Object (readonly)
Returns the value of attribute groups.
7 8 9 |
# File 'lib/inspec/utils/deprecation/deprecator.rb', line 7 def groups @groups end |
Instance Method Details
#handle_deprecation(group_name, message, opts = {}) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/inspec/utils/deprecation/deprecator.rb', line 14 def handle_deprecation(group_name, , opts = {}) group = groups[group_name.to_sym] || create_group_entry_for_unknown_group(group_name) annotate_stack_information(opts) = (, group, opts) action = group[:action] || :warn action_method = ("handle_" + action.to_s + "_action").to_sym send(action_method, group_name.to_sym, , group) end |