Class: DatabaseDocumenter::Exporters::BaseExporter
- Inherits:
-
Object
- Object
- DatabaseDocumenter::Exporters::BaseExporter
- Defined in:
- lib/database_documenter/exporters/base_exporter.rb
Direct Known Subclasses
Constant Summary collapse
- APP_NAME =
ENV['APP_NAME']&.capitalize || "Project"
- HEADER_SECOND_LINE =
"The database design specifies how the data of the software is going to be stored."
Instance Attribute Summary collapse
-
#commented_cols_count ⇒ Object
Returns the value of attribute commented_cols_count.
-
#generated_cols_count ⇒ Object
Returns the value of attribute generated_cols_count.
-
#printed_tables ⇒ Object
Returns the value of attribute printed_tables.
-
#table_data ⇒ Object
Returns the value of attribute table_data.
Instance Method Summary collapse
-
#initialize ⇒ BaseExporter
constructor
A new instance of BaseExporter.
- #load_all_models ⇒ Object
-
#skip_class?(klass) ⇒ Boolean
Skip STI classes Skip duplicate tables in case of has_and_belongs_to_many Skip certain modules.
Constructor Details
#initialize ⇒ BaseExporter
Returns a new instance of BaseExporter.
10 11 12 13 14 15 |
# File 'lib/database_documenter/exporters/base_exporter.rb', line 10 def initialize self.table_data = DatabaseDocumenter::TableData.new self.printed_tables = [] self.generated_cols_count = 0 self.commented_cols_count = 0 end |
Instance Attribute Details
#commented_cols_count ⇒ Object
Returns the value of attribute commented_cols_count.
5 6 7 |
# File 'lib/database_documenter/exporters/base_exporter.rb', line 5 def commented_cols_count @commented_cols_count end |
#generated_cols_count ⇒ Object
Returns the value of attribute generated_cols_count.
5 6 7 |
# File 'lib/database_documenter/exporters/base_exporter.rb', line 5 def generated_cols_count @generated_cols_count end |
#printed_tables ⇒ Object
Returns the value of attribute printed_tables.
5 6 7 |
# File 'lib/database_documenter/exporters/base_exporter.rb', line 5 def printed_tables @printed_tables end |
#table_data ⇒ Object
Returns the value of attribute table_data.
5 6 7 |
# File 'lib/database_documenter/exporters/base_exporter.rb', line 5 def table_data @table_data end |
Instance Method Details
#load_all_models ⇒ Object
17 18 19 |
# File 'lib/database_documenter/exporters/base_exporter.rb', line 17 def load_all_models Rails.application.eager_load! end |
#skip_class?(klass) ⇒ Boolean
Skip STI classes Skip duplicate tables in case of has_and_belongs_to_many Skip certain modules
24 25 26 27 |
# File 'lib/database_documenter/exporters/base_exporter.rb', line 24 def skip_class?(klass) (klass.class.name != klass.base_class.class.name) || klass.abstract_class? || (printed_tables.include? klass.table_name) || (DatabaseDocumenter.configuration.skipped_modules.include? klass.parent.name) end |