Sha256: 8d4aa768c5c67ecafb34b3454cd9495ee8363c06841e85278d6e96953af3f6ba

Contents?: true

Size: 461 Bytes

Versions: 4

Compression:

Stored size: 461 Bytes

Contents

# encoding: utf-8

module Rubocop
  module Cop
    module Util
      module_function

      def strip_quotes(str)
        if str[0] == '"' || str[0] == "'"
          str[0] = ''
          str[-1] = ''
        else
          # we're dealing with %q or %Q
          str[0, 3] = ''
          str[-1] = ''
        end

        str
      end

      def block_length(block_node)
        block_node.loc.end.line - block_node.loc.begin.line
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rubocop-0.8.3 lib/rubocop/cop/util.rb
rubocop-0.8.2 lib/rubocop/cop/util.rb
rubocop-0.8.1 lib/rubocop/cop/util.rb
rubocop-0.8.0 lib/rubocop/cop/util.rb