Class: Exwiw::DbSchemaGenerator::TidyResult
- Inherits:
-
SchemaGenerator::TidyResult
- Object
- SchemaGenerator::TidyResult
- Exwiw::DbSchemaGenerator::TidyResult
- Defined in:
- lib/exwiw/db_schema_generator.rb
Overview
SchemaGenerator::TidyResult plus the belongs_tos this generator can also remove. Subclassed rather than extended in place so the ActiveRecord generator's result — and the rake task reporting it — keeps exactly the contract it has today.
Instance Attribute Summary collapse
-
#removed_belongs_tos ⇒ Object
readonly
Returns the value of attribute removed_belongs_tos.
Attributes inherited from SchemaGenerator::TidyResult
#removed_columns, #removed_tables
Instance Method Summary collapse
- #add_removed_belongs_to(table_name, target_table_name) ⇒ Object
- #empty? ⇒ Boolean
-
#initialize ⇒ TidyResult
constructor
A new instance of TidyResult.
Methods inherited from SchemaGenerator::TidyResult
#add_removed_column, #add_removed_table
Constructor Details
#initialize ⇒ TidyResult
Returns a new instance of TidyResult.
26 27 28 29 |
# File 'lib/exwiw/db_schema_generator.rb', line 26 def initialize super @removed_belongs_tos = {} end |
Instance Attribute Details
#removed_belongs_tos ⇒ Object (readonly)
Returns the value of attribute removed_belongs_tos.
24 25 26 |
# File 'lib/exwiw/db_schema_generator.rb', line 24 def removed_belongs_tos @removed_belongs_tos end |
Instance Method Details
#add_removed_belongs_to(table_name, target_table_name) ⇒ Object
31 32 33 |
# File 'lib/exwiw/db_schema_generator.rb', line 31 def add_removed_belongs_to(table_name, target_table_name) (@removed_belongs_tos[table_name] ||= []) << target_table_name end |
#empty? ⇒ Boolean
35 36 37 |
# File 'lib/exwiw/db_schema_generator.rb', line 35 def empty? super && @removed_belongs_tos.empty? end |