Class: DatarocketsStyle::Cop::Style::NestedInterpolation
- Inherits:
-
RuboCop::Cop::Cop
- Object
- RuboCop::Cop::Cop
- DatarocketsStyle::Cop::Style::NestedInterpolation
- Includes:
- RuboCop::Cop::Interpolation
- Defined in:
- lib/datarockets_style/cop/style/nested_interpolation.rb
Overview
This cop checks nested interpolations
# bad “Hello, #? ‘guest’ : ”dear #{user.name“}”
# good user_name = user.blank? ? ‘guest’ : “dear #useruser.name” “Hello, #user_name”
Constant Summary collapse
- MSG =
"Redundant nested interpolation."
Instance Method Summary collapse
Instance Method Details
#on_interpolation(node) ⇒ Object
21 22 23 24 25 |
# File 'lib/datarockets_style/cop/style/nested_interpolation.rb', line 21 def on_interpolation(node) node.each_descendant(:dstr) do |descendant_node| detect_double_interpolation(descendant_node) end end |