Class: Convergence::ForeignKey

Inherits:
Object
  • Object
show all
Defined in:
lib/convergence/foreign_key.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key_name, from_columns, to_table, to_columns, options) ⇒ ForeignKey

Returns a new instance of ForeignKey.



4
5
6
7
8
9
10
# File 'lib/convergence/foreign_key.rb', line 4

def initialize(key_name, from_columns, to_table, to_columns, options)
  @key_name = key_name
  @from_columns = [from_columns].flatten.map(&:to_s)
  @to_table = to_table.to_s
  @to_columns = [to_columns].flatten.map(&:to_s)
  @options = { name: @key_name }.merge(options)
end

Instance Attribute Details

#from_columnsObject

Returns the value of attribute from_columns.



2
3
4
# File 'lib/convergence/foreign_key.rb', line 2

def from_columns
  @from_columns
end

#key_nameObject

Returns the value of attribute key_name.



2
3
4
# File 'lib/convergence/foreign_key.rb', line 2

def key_name
  @key_name
end

#optionsObject

Returns the value of attribute options.



2
3
4
# File 'lib/convergence/foreign_key.rb', line 2

def options
  @options
end

#to_columnsObject

Returns the value of attribute to_columns.



2
3
4
# File 'lib/convergence/foreign_key.rb', line 2

def to_columns
  @to_columns
end

#to_tableObject

Returns the value of attribute to_table.



2
3
4
# File 'lib/convergence/foreign_key.rb', line 2

def to_table
  @to_table
end