Class: Exwiw::SchemaGenerator::TidyResult

Inherits:
Object
  • Object
show all
Defined in:
lib/exwiw/schema_generator.rb

Overview

Summary of what ‘SchemaGenerator#tidy!` removed, returned so callers can report it. `removed_columns` maps a surviving table’s name to the column names that were dropped from its config.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTidyResult

Returns a new instance of TidyResult.



14
15
16
17
# File 'lib/exwiw/schema_generator.rb', line 14

def initialize
  @removed_tables = []
  @removed_columns = {}
end

Instance Attribute Details

#removed_columnsObject (readonly)

Returns the value of attribute removed_columns.



12
13
14
# File 'lib/exwiw/schema_generator.rb', line 12

def removed_columns
  @removed_columns
end

#removed_tablesObject (readonly)

Returns the value of attribute removed_tables.



12
13
14
# File 'lib/exwiw/schema_generator.rb', line 12

def removed_tables
  @removed_tables
end

Instance Method Details

#add_removed_column(table_name, column_name) ⇒ Object



23
24
25
# File 'lib/exwiw/schema_generator.rb', line 23

def add_removed_column(table_name, column_name)
  (@removed_columns[table_name] ||= []) << column_name
end

#add_removed_table(table_name) ⇒ Object



19
20
21
# File 'lib/exwiw/schema_generator.rb', line 19

def add_removed_table(table_name)
  @removed_tables << table_name
end

#empty?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/exwiw/schema_generator.rb', line 27

def empty?
  @removed_tables.empty? && @removed_columns.empty?
end