Sha256: d9f991a1eee993fb7ae5fb9c5534bfd992ef97fe4361640fd6bb193fab7439b4

Contents?: true

Size: 528 Bytes

Versions: 5

Compression:

Stored size: 528 Bytes

Contents

# encoding: utf-8

module Rubocop
  module Cop
    # This module contains a collection of useful utility methods.
    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

5 entries across 5 versions & 2 rubygems

Version Path
rubocop-0.11.1 lib/rubocop/cop/util.rb
rubocop-0.11.0 lib/rubocop/cop/util.rb
rubocop-0.10.0 lib/rubocop/cop/util.rb
sabat-rubocop-0.9.0 lib/rubocop/cop/util.rb
rubocop-0.9.0 lib/rubocop/cop/util.rb