Method: RuboCop::Cop::Lint::TrailingCommaInAttributeDeclaration#on_send

Defined in:
lib/rubocop/cop/lint/trailing_comma_in_attribute_declaration.rb

#on_send(node) ⇒ Object


36
37
38
39
40
41
42
# File 'lib/rubocop/cop/lint/trailing_comma_in_attribute_declaration.rb', line 36

def on_send(node)
  return unless node.attribute_accessor? && node.last_argument.def_type?

  trailing_comma = trailing_comma_range(node)

  add_offense(trailing_comma) { |corrector| corrector.remove(trailing_comma) }
end