class DDLParser::Translator::CreateIndexHeader

Attributes

index_columns[RW]
index_head[RW]

Public Class Methods

new(index_hash) click to toggle source
# File lib/ddl_parser/translator/create_index_header.rb, line 6
def initialize(index_hash)
  if index_hash.is_a?(Hash) and index_hash.count > 1
    @index_head = index_hash
    @index_columns = [{:field =>index_hash[:field], :sort_type => index_hash[:sort_type]}]
  else
    if index_hash.is_a?(Array) and index_hash.count > 1
      @index_head = index_hash.first.is_a?(Hash) ? index_hash.first : {}
      @index_columns = index_hash[1..-1]
    else
      @index_head = {}
      @index_columns = []
    end
  end
end

Public Instance Methods

columns() click to toggle source
# File lib/ddl_parser/translator/create_index_header.rb, line 45
def columns
  index_columns.map{|e|DDLParser::Translator::Column.new(e)}
end
index_name() click to toggle source
# File lib/ddl_parser/translator/create_index_header.rb, line 29
def index_name
  @index_head[:index_name].to_s
end
object_property() click to toggle source
# File lib/ddl_parser/translator/create_index_header.rb, line 37
def object_property
  @index_head[:object_property]
end
option_reverse_scans() click to toggle source
# File lib/ddl_parser/translator/create_index_header.rb, line 41
def option_reverse_scans
  index_head.has_key?(:index_option) && index_head[:index_option].has_key?(:reverse_scans_property) ? 'Y' : 'N'
end
parse_tree() click to toggle source
# File lib/ddl_parser/translator/create_index_header.rb, line 25
def parse_tree
  to_hash
end
table_name() click to toggle source
# File lib/ddl_parser/translator/create_index_header.rb, line 33
def table_name
  @index_head[:table_name].to_s
end
to_hash() click to toggle source
# File lib/ddl_parser/translator/create_index_header.rb, line 21
def to_hash
  {:head => @index_head, :columns => @index_columns}
end