Class: Mkxms::Mssql::TableType::ConstraintColumn

Inherits:
Object
  • Object
show all
Defined in:
lib/mkxms/mssql/table_type_handler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs) ⇒ ConstraintColumn

Returns a new instance of ConstraintColumn.



65
66
67
68
# File 'lib/mkxms/mssql/table_type_handler.rb', line 65

def initialize(attrs)
  @name = attrs['name']
  @ascending = !attrs['desc']
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



70
71
72
# File 'lib/mkxms/mssql/table_type_handler.rb', line 70

def name
  @name
end

Instance Method Details

#ascending=(val) ⇒ Object



74
# File 'lib/mkxms/mssql/table_type_handler.rb', line 74

def ascending=(val); @ascending = !!val; end

#ascending?Boolean

Returns:

  • (Boolean)


72
# File 'lib/mkxms/mssql/table_type_handler.rb', line 72

def ascending?; @ascending; end

#descending=(val) ⇒ Object



75
# File 'lib/mkxms/mssql/table_type_handler.rb', line 75

def descending=(val); @ascending = !val; end

#descending?Boolean

Returns:

  • (Boolean)


73
# File 'lib/mkxms/mssql/table_type_handler.rb', line 73

def descending?; !@ascending; end

#specObject



77
78
79
# File 'lib/mkxms/mssql/table_type_handler.rb', line 77

def spec
  "#{name} #{ascending? ? "ASC" : "DESC"}"
end