Sha256: 4ac12ec1ea58412c966e6a4cdede173694d73f70d1d204f1b254c9c758e3e054

Contents?: true

Size: 814 Bytes

Versions: 3

Compression:

Stored size: 814 Bytes

Contents

# encoding: utf-8

module Rubocop
  module Cop
    module Style
      # Classes that include this module just implement functions to determine
      # what is an offence and how to do auto-correction. They get help with
      # adding offences for the faulty string nodes, and with filtering out
      # nodes.
      module StringHelp
        def on_str(node)
          # Constants like __FILE__ are handled as strings,
          # but don't respond to begin.
          return unless node.loc.respond_to?(:begin) && node.loc.begin
          return if part_of_ignored_node?(node)

          convention(node, :expression) if offence?(node)
        end

        def on_dstr(node)
          ignore_node(node)
        end

        def on_regexp(node)
          ignore_node(node)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rubocop-0.15.0 lib/rubocop/cop/style/string_help.rb
rubocop-0.14.1 lib/rubocop/cop/style/string_help.rb
rubocop-0.14.0 lib/rubocop/cop/style/string_help.rb