Class: Lhm::ColumnWithType

Inherits:
Object
  • Object
show all
Defined in:
lib/lhm/column_with_type.rb

Overview

Abstracts the details of a table column definition when specified with a type as a symbol. This is the regular ActiveRecord’s #add_column syntax:

add_column :tablenames, :field, :string

Instance Method Summary collapse

Constructor Details

#initialize(name, definition) ⇒ ColumnWithType

Constructor

Parameters:

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


14
15
16
17
# File 'lib/lhm/column_with_type.rb', line 14

def initialize(name, definition)
  @name = name
  @definition = definition
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)


23
24
25
# File 'lib/lhm/column_with_type.rb', line 23

def attributes
  [definition]
end