Sha256: dd9752a921b05d51fc51791773e982371dabb35f29ecea0c2fb3a992eae221af

Contents?: true

Size: 589 Bytes

Versions: 1

Compression:

Stored size: 589 Bytes

Contents

# encoding: utf-8

module Rubocop
  module Cop
    # Common functionality for handling percent literals.
    module PercentLiteral
      def percent_literal?(node)
        if (begin_source = begin_source(node))
          begin_source.start_with?('%')
        end
      end

      def process(node, *types)
        on_percent_literal(node, types) if percent_literal?(node)
      end

      def begin_source(node)
        node.loc.begin.source if node.loc.respond_to?(:begin) && node.loc.begin
      end

      def type(node)
        node.loc.begin.source[0..-2]
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubocop-0.21.0 lib/rubocop/cop/mixin/percent_literal.rb