class RuboCop::Cop::Chef::Deprecations::NodeDeepFetch
The node.deep_fetch method has been removed from Chef-Sugar, and must be replaced by the node.read API.
@example
### incorrect node.deep_fetch("foo") ### correct node.read("foo") ### incorrect node.deep_fetch!("foo") ### correct node.read!("foo")
Constants
- RESTRICT_ON_SEND
Public Instance Methods
Source
# File lib/rubocop/cop/chef/deprecation/node_deep_fetch.rb, line 46 def on_send(node) node_deep_fetch?(node) do add_offense(node.loc.selector, message: "Do not use node.#{node.method_name}. Replace with node.#{fix_name(node.method_name)} to keep identical behavior.", severity: :warning) do |corrector| corrector.replace(node.loc.selector, fix_name(node.method_name)) end end end
Private Instance Methods
Source
# File lib/rubocop/cop/chef/deprecation/node_deep_fetch.rb, line 56 def fix_name(name) return 'read!' if name == :deep_fetch! return 'read' if name == :deep_fetch name.to_s end