Class: RuboCop::Rails::SchemaLoader::AddIndex

Inherits:
Index
  • Object
show all
Defined in:
lib/rubocop/rails/schema_loader/schema.rb

Overview

Represent an ‘add_index`

Instance Attribute Summary collapse

Attributes inherited from Index

#columns, #expression, #name, #unique

Instance Method Summary collapse

Constructor Details

#initialize(node) ⇒ AddIndex

Returns a new instance of AddIndex.



180
181
182
183
184
185
186
187
188
# File 'lib/rubocop/rails/schema_loader/schema.rb', line 180

def initialize(node)
  super

  @table_name = node.first_argument.value
  @columns, @expression = build_columns_or_expr(node.arguments[1])
  @unique = nil

  analyze_keywords!(node)
end

Instance Attribute Details

#table_nameObject (readonly)

Returns the value of attribute table_name.



178
179
180
# File 'lib/rubocop/rails/schema_loader/schema.rb', line 178

def table_name
  @table_name
end