Class: PgDiff::Attribute
- Inherits:
-
Object
- Object
- PgDiff::Attribute
- Defined in:
- lib/attribute.rb
Instance Attribute Summary collapse
-
#default ⇒ Object
Returns the value of attribute default.
-
#name ⇒ Object
Returns the value of attribute name.
-
#notnull ⇒ Object
Returns the value of attribute notnull.
-
#type_def ⇒ Object
Returns the value of attribute type_def.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #definition ⇒ Object
-
#initialize(name, typedef, notnull, default) ⇒ Attribute
constructor
A new instance of Attribute.
Constructor Details
#initialize(name, typedef, notnull, default) ⇒ Attribute
Returns a new instance of Attribute.
5 6 7 8 9 10 |
# File 'lib/attribute.rb', line 5 def initialize(name, typedef, notnull, default) @name = name @type_def = typedef @notnull = notnull @default = default end |
Instance Attribute Details
#default ⇒ Object
Returns the value of attribute default.
3 4 5 |
# File 'lib/attribute.rb', line 3 def default @default end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/attribute.rb', line 3 def name @name end |
#notnull ⇒ Object
Returns the value of attribute notnull.
3 4 5 |
# File 'lib/attribute.rb', line 3 def notnull @notnull end |
#type_def ⇒ Object
Returns the value of attribute type_def.
3 4 5 |
# File 'lib/attribute.rb', line 3 def type_def @type_def end |
Instance Method Details
#==(other) ⇒ Object
19 20 21 |
# File 'lib/attribute.rb', line 19 def == (other) definition == other.definition end |
#definition ⇒ Object
12 13 14 15 16 17 |
# File 'lib/attribute.rb', line 12 def definition out = [' ', @name, @type_def] out << 'NOT NULL' if @notnull out << 'DEFAULT ' + @default if @default out.join(" ") end |