Parent

Files

Class/Module Index [+]

Quicksearch

RuboCop::Cop::Style::SpaceAroundOperators

Checks that operators have space around them, except for ** which should not have surrounding space.

Constants

TYPES

Public Instance Methods

on_if(node) click to toggle source
# File lib/rubocop/cop/style/space_around_operators.rb, line 16
def on_if(node)
  return unless node.loc.respond_to?(:question)

  check_operator(node.loc.question)
  check_operator(node.loc.colon)
end
on_pair(node) click to toggle source
# File lib/rubocop/cop/style/space_around_operators.rb, line 12
def on_pair(node)
  check(node) if node.loc.operator.is?('=>')
end
on_resbody(node) click to toggle source
# File lib/rubocop/cop/style/space_around_operators.rb, line 23
def on_resbody(node)
  check_operator(node.loc.assoc) if node.loc.assoc
end
on_send(node) click to toggle source
# File lib/rubocop/cop/style/space_around_operators.rb, line 27
def on_send(node)
  if node.loc.operator
    check(node)
  elsif !unary_operation?(node) && !called_with_dot?(node)
    op = node.loc.selector
    check_operator(op) if operator?(op)
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.