Class: Mkxms::Mssql::IndexHandler

Inherits:
Object
  • Object
show all
Includes:
PropertyHandler::ElementHandler
Defined in:
lib/mkxms/mssql/index_handler.rb

Instance Method Summary collapse

Methods included from PropertyHandler::ElementHandler

#handle_property_element

Constructor Details

#initialize(indexes, node) ⇒ IndexHandler

Returns a new instance of IndexHandler.



76
77
78
79
80
81
# File 'lib/mkxms/mssql/index_handler.rb', line 76

def initialize(indexes, node)
  @index = Index.new(node.attributes).tap do |i|
    store_properties_on i
    indexes << i
  end
end

Instance Method Details

#handle_column_element(parse) ⇒ Object



83
84
85
86
87
88
89
90
91
# File 'lib/mkxms/mssql/index_handler.rb', line 83

def handle_column_element(parse)
  a = parse.node.attributes
  
  if a['included']
    @index.included_columns << IndexColumn.new(a['name'])
  else
    @index.columns << IndexColumn.new(a['name'], a['desc'] ? :descending : :ascending)
  end
end