Class: Dbsketch::Model::Column
- Inherits:
-
AbstractColumn
- Object
- Database_Object
- AbstractColumn
- Dbsketch::Model::Column
- Defined in:
- lib/dbsketch/model/column.rb
Instance Attribute Summary collapse
-
#default ⇒ Object
Returns the value of attribute default.
-
#identity ⇒ Object
readonly
Returns the value of attribute identity.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Attributes inherited from AbstractColumn
Attributes inherited from Database_Object
#comment, #dependencies, #meaning, #name, #order
Instance Method Summary collapse
- #compatible_with?(other_column) ⇒ Boolean
-
#initialize(name, type, meaning: nil, comment: nil, nullable: true, order: nil, identity: false, default: nil) ⇒ Column
constructor
A new instance of Column.
Methods inherited from Database_Object
#add_dependencies, #class_name, #compute_order!, #inspect, #reset_order!
Constructor Details
#initialize(name, type, meaning: nil, comment: nil, nullable: true, order: nil, identity: false, default: nil) ⇒ Column
Returns a new instance of Column.
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/dbsketch/model/column.rb', line 12 def initialize name, type, meaning: nil, comment: nil, nullable: true, order: nil, identity: false, default: nil super(name, :meaning => meaning, :comment => comment, :nullable => nullable, :order => order) ### Preconditions raise ArgumentError, "type is not a Dbsketch::Model::Type" unless type.is_a? Dbsketch::Model::Type raise ArgumentError, "identity is not a boolean" unless identity.is_a? TrueClass or identity.is_a? FalseClass ### @type = type @identity = identity @default = default end |
Instance Attribute Details
#default ⇒ Object
Returns the value of attribute default.
23 24 25 |
# File 'lib/dbsketch/model/column.rb', line 23 def default @default end |
#identity ⇒ Object (readonly)
Returns the value of attribute identity.
23 24 25 |
# File 'lib/dbsketch/model/column.rb', line 23 def identity @identity end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
23 24 25 |
# File 'lib/dbsketch/model/column.rb', line 23 def type @type end |
Instance Method Details
#compatible_with?(other_column) ⇒ Boolean
26 27 28 29 30 31 |
# File 'lib/dbsketch/model/column.rb', line 26 def compatible_with? other_column ### Preconditions raise ArgumentError, "other_column is not a Dbsketch::Model::Column" unless other_column.is_a? Column ### (@type.compatible_with? other_column.type) and (not @nullable or other_column.nullable) end |