Parent

Methods

Files

Class/Module Index [+]

Quicksearch

RuboCop::Cop::Lint::LiteralInInterpolation

This cop checks for interpolated literals.

@example

"result is #{10}"

Constants

LITERALS
MSG

Public Instance Methods

on_dstr(node) click to toggle source
# File lib/rubocop/cop/lint/literal_in_interpolation.rb, line 16
def on_dstr(node)
  node.children.select { |n| n.type == :begin }.each do |begin_node|
    final_node = begin_node.children.last
    next unless final_node
    # handle strings like __FILE__
    return if special_string?(final_node)
    next unless LITERALS.include?(final_node.type)

    add_offense(final_node, :expression)
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.