Class: Droonga::Catalog::Schema::ColumnCreateSorter
- Inherits:
-
Object
- Object
- Droonga::Catalog::Schema::ColumnCreateSorter
- Includes:
- TSort
- Defined in:
- lib/droonga/catalog/schema.rb
Instance Method Summary collapse
- #all_columns ⇒ Object
-
#initialize(tables) ⇒ ColumnCreateSorter
constructor
A new instance of ColumnCreateSorter.
- #tsort_each_child(column, &block) ⇒ Object
- #tsort_each_node(&block) ⇒ Object
Constructor Details
#initialize(tables) ⇒ ColumnCreateSorter
Returns a new instance of ColumnCreateSorter.
211 212 213 |
# File 'lib/droonga/catalog/schema.rb', line 211 def initialize(tables) @tables = tables end |
Instance Method Details
#all_columns ⇒ Object
215 216 217 |
# File 'lib/droonga/catalog/schema.rb', line 215 def all_columns @tables.values.collect {|table| table.columns.values}.flatten end |
#tsort_each_child(column, &block) ⇒ Object
223 224 225 226 227 228 229 230 231 232 |
# File 'lib/droonga/catalog/schema.rb', line 223 def tsort_each_child(column, &block) dependent_column_names = column..sources || [] dependent_column_names -= ["_key"] # _key always exists after the table created reference_table = @tables[column.value_type_groonga] # TODO when _key specified, check to ensure reference_table is not Array dependent_columns = dependent_column_names.collect do |column_name| reference_table.columns[column_name] end dependent_columns.each(&block) end |
#tsort_each_node(&block) ⇒ Object
219 220 221 |
# File 'lib/droonga/catalog/schema.rb', line 219 def tsort_each_node(&block) all_columns.each(&block) end |