Class: Exwiw::SchemaGenerator::TidyResult
- Inherits:
-
Object
- Object
- Exwiw::SchemaGenerator::TidyResult
- 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
-
#removed_columns ⇒ Object
readonly
Returns the value of attribute removed_columns.
-
#removed_tables ⇒ Object
readonly
Returns the value of attribute removed_tables.
Instance Method Summary collapse
- #add_removed_column(table_name, column_name) ⇒ Object
- #add_removed_table(table_name) ⇒ Object
- #empty? ⇒ Boolean
-
#initialize ⇒ TidyResult
constructor
A new instance of TidyResult.
Constructor Details
#initialize ⇒ TidyResult
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_columns ⇒ Object (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_tables ⇒ Object (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
27 28 29 |
# File 'lib/exwiw/schema_generator.rb', line 27 def empty? @removed_tables.empty? && @removed_columns.empty? end |