Class: Convergence::ForeignKey
- Inherits:
-
Object
- Object
- Convergence::ForeignKey
- Defined in:
- lib/convergence/foreign_key.rb
Instance Attribute Summary collapse
-
#from_columns ⇒ Object
Returns the value of attribute from_columns.
-
#key_name ⇒ Object
Returns the value of attribute key_name.
-
#options ⇒ Object
Returns the value of attribute options.
-
#to_columns ⇒ Object
Returns the value of attribute to_columns.
-
#to_table ⇒ Object
Returns the value of attribute to_table.
Instance Method Summary collapse
-
#initialize(key_name, from_columns, to_table, to_columns, options) ⇒ ForeignKey
constructor
A new instance of ForeignKey.
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, ) @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() end |
Instance Attribute Details
#from_columns ⇒ Object
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_name ⇒ Object
Returns the value of attribute key_name.
2 3 4 |
# File 'lib/convergence/foreign_key.rb', line 2 def key_name @key_name end |
#options ⇒ Object
Returns the value of attribute options.
2 3 4 |
# File 'lib/convergence/foreign_key.rb', line 2 def @options end |
#to_columns ⇒ Object
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_table ⇒ Object
Returns the value of attribute to_table.
2 3 4 |
# File 'lib/convergence/foreign_key.rb', line 2 def to_table @to_table end |