Sha256: 3b0d13ed59f129baf6883f9866a2e5d03abb26a2a4a4c0a9ff7190f12f37ae07

Contents?: true

Size: 551 Bytes

Versions: 11

Compression:

Stored size: 551 Bytes

Contents

# encoding: utf-8
# frozen_string_literal: true

module RuboCop
  module Cop
    # Common functionality for handling parentheses.
    module Parentheses
      def parens_required?(node)
        range  = node.source_range
        source = range.source_buffer.source
        source[range.begin_pos - 1] =~ /[a-z]/ ||
          source[range.end_pos] =~ /[a-z]/
      end

      def autocorrect(node)
        lambda do |corrector|
          corrector.remove(node.loc.begin)
          corrector.remove(node.loc.end)
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
fluent-plugin-detect-memb-exceptions-0.0.2 vendor/bundle/ruby/2.0.0/gems/rubocop-0.42.0/lib/rubocop/cop/mixin/parentheses.rb
fluent-plugin-detect-memb-exceptions-0.0.1 vendor/bundle/ruby/2.0.0/gems/rubocop-0.42.0/lib/rubocop/cop/mixin/parentheses.rb
rubocop-0.43.0 lib/rubocop/cop/mixin/parentheses.rb
rubocop-0.42.0 lib/rubocop/cop/mixin/parentheses.rb
rubocop-0.41.2 lib/rubocop/cop/mixin/parentheses.rb
rubocop-0.41.1 lib/rubocop/cop/mixin/parentheses.rb
rubocop-0.41.0 lib/rubocop/cop/mixin/parentheses.rb
rubocop-0.40.0 lib/rubocop/cop/mixin/parentheses.rb
rubocop-0.39.0 lib/rubocop/cop/mixin/parentheses.rb
rubocop-0.38.0 lib/rubocop/cop/mixin/parentheses.rb
rubocop-0.37.2 lib/rubocop/cop/mixin/parentheses.rb