class RuboCop::Rails::SchemaLoader::Column

Represent a column

Attributes

name[R]
not_null[R]
type[R]

Public Class Methods

new(node) click to toggle source
# File lib/rubocop/rails/schema_loader/schema.rb, line 116
def initialize(node)
  @name = node.first_argument.str_content
  @type = node.method_name
  @not_null = nil

  analyze_keywords!(node)
end

Private Instance Methods

analyze_keywords!(node) click to toggle source
# File lib/rubocop/rails/schema_loader/schema.rb, line 126
def analyze_keywords!(node)
  pairs = node.arguments.last
  return unless pairs.hash_type?

  pairs.each_pair do |k, v|
    @not_null = !v.true_type? if k.value == :null
  end
end