Class: Lhm::ColumnWithSql

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/lhm/column_with_sql.rb

Overview

Abstracts the details of a table column definition when specified with a MySQL column definition string

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, definition) ⇒ ColumnWithSql

Constructor

Parameters:

  • name (String, Symbol)
  • definition (String)


21
22
23
24
# File 'lib/lhm/column_with_sql.rb', line 21

def initialize(name, definition)
  @name = name
  @definition = definition
end

Class Method Details

.column_factoryConstant

Returns the column’s class to be used

Returns:

  • (Constant)


13
14
15
# File 'lib/lhm/column_with_sql.rb', line 13

def self.column_factory
  ::ActiveRecord::ConnectionAdapters::PerconaMigratorAdapter::Column
end

Instance Method Details

#attributesArray

Returns the column data as an Array to be used with the splat operator. See Lhm::Adaper#add_column

Returns:

  • (Array)


30
31
32
# File 'lib/lhm/column_with_sql.rb', line 30

def attributes
  [type, column_options]
end