class PgDiff::Attribute

Attributes

default[RW]
name[RW]
notnull[RW]
type_def[RW]

Public Class Methods

new(name, typedef, notnull, default) click to toggle source
# File lib/attribute.rb, line 5
def initialize(name, typedef, notnull, default)
  @name = name
  @type_def = typedef
  @notnull = notnull
  @default = default
end

Public Instance Methods

==(other) click to toggle source
# File lib/attribute.rb, line 19
def == (other)
  definition == other.definition
end
definition() click to toggle source
# 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