Method: RuboCop::Cop::Style::StringLiterals#on_dstr
- Defined in:
- lib/rubocop/cop/style/string_literals.rb
#on_dstr(node) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/rubocop/cop/style/string_literals.rb', line 37 def on_dstr(node) # Strings which are continued across multiple lines using \ # are parsed as a `dstr` node with `str` children # If one part of that continued string contains interpolations, # then it will be parsed as a nested `dstr` node return unless consistent_multiline? return if node.heredoc? children = node.children return unless all_string_literals?(children) quote_styles = detect_quote_styles(node) if quote_styles.size > 1 register_offense(node, message: MSG_INCONSISTENT) else check_multiline_quote_style(node, quote_styles[0]) end ignore_node(node) end |