class MysqlWarmup::Table
Constants
- DESC_TABLE_STRUCTURE
Attributes
indexes[R]
Public Class Methods
new(table_name, field_infos)
click to toggle source
# File lib/mysql_warmup/table.rb, line 14 def initialize(table_name, field_infos) @table_name = table_name @field_infos = field_infos @indexes = build_index end
Private Instance Methods
build_index()
click to toggle source
# File lib/mysql_warmup/table.rb, line 22 def build_index indexes_infos = [] non_indexes_info = [] @field_infos.each { |v| v[DESC_TABLE_STRUCTURE[:key]].empty? ? non_indexes_info << v : indexes_infos << v } non_index_field = non_indexes_info.empty? ? nil : non_indexes_info[0][DESC_TABLE_STRUCTURE[:field]] indexes = [] indexes_infos.each do |index_info| indexes << MysqlWarmup::Index.new(@table_name, index_info[DESC_TABLE_STRUCTURE[:field]], index_info[DESC_TABLE_STRUCTURE[:type]], index_info[DESC_TABLE_STRUCTURE[:key]], non_index_field) end indexes end