Class: TableSaw::ForeignKey
- Inherits:
-
Object
- Object
- TableSaw::ForeignKey
- Defined in:
- lib/table_saw/foreign_key.rb
Defined Under Namespace
Classes: Column
Instance Attribute Summary collapse
-
#from_column ⇒ Object
readonly
Returns the value of attribute from_column.
-
#from_table ⇒ Object
readonly
Returns the value of attribute from_table.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#to_column ⇒ Object
readonly
Returns the value of attribute to_column.
-
#to_table ⇒ Object
readonly
Returns the value of attribute to_table.
Instance Method Summary collapse
- #column ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(from_table:, from_column:, to_table:, to_column:, name: nil) ⇒ ForeignKey
constructor
A new instance of ForeignKey.
- #type_condition ⇒ Object
Constructor Details
#initialize(from_table:, from_column:, to_table:, to_column:, name: nil) ⇒ ForeignKey
Returns a new instance of ForeignKey.
39 40 41 42 43 44 45 |
# File 'lib/table_saw/foreign_key.rb', line 39 def initialize(from_table:, from_column:, to_table:, to_column:, name: nil) @name = name @from_table = from_table @from_column = from_column @to_table = to_table @to_column = to_column end |
Instance Attribute Details
#from_column ⇒ Object (readonly)
Returns the value of attribute from_column.
37 38 39 |
# File 'lib/table_saw/foreign_key.rb', line 37 def from_column @from_column end |
#from_table ⇒ Object (readonly)
Returns the value of attribute from_table.
37 38 39 |
# File 'lib/table_saw/foreign_key.rb', line 37 def from_table @from_table end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
37 38 39 |
# File 'lib/table_saw/foreign_key.rb', line 37 def name @name end |
#to_column ⇒ Object (readonly)
Returns the value of attribute to_column.
37 38 39 |
# File 'lib/table_saw/foreign_key.rb', line 37 def to_column @to_column end |
#to_table ⇒ Object (readonly)
Returns the value of attribute to_table.
37 38 39 |
# File 'lib/table_saw/foreign_key.rb', line 37 def to_table @to_table end |
Instance Method Details
#column ⇒ Object
51 52 53 |
# File 'lib/table_saw/foreign_key.rb', line 51 def column @column ||= Column.new(from_column) end |
#eql?(other) ⇒ Boolean
55 56 57 |
# File 'lib/table_saw/foreign_key.rb', line 55 def eql?(other) hash == other.hash end |
#hash ⇒ Object
59 60 61 |
# File 'lib/table_saw/foreign_key.rb', line 59 def hash [from_table, from_column, to_table, to_column].hash end |
#type_condition ⇒ Object
47 48 49 |
# File 'lib/table_saw/foreign_key.rb', line 47 def type_condition @type_condition ||= column.type_condition end |