class RuboCop::Cop::Bugcrowd::PreferTextToStringColumn

Constants

MSG

Public Instance Methods

on_send(node) click to toggle source
# File lib/rubocop/cop/bugcrowd/prefer_text_to_string_column.rb, line 24
def on_send(node)
  return unless within_change_or_up_method?(node)

  if add_column_with_string?(node)
    add_offense(node)
  elsif string_method_sent_to_var?(node)
    # blocks that have multiple expressions within them get wrapped
    # with a 'begin' type :shrug:
    parent = node.parent.begin_type? ? node.parent.parent : node.parent

    add_offense(node) if within_create_table_block?(parent)
  end
end