Class: DatabaseDocumenter::Exporters::BaseExporter

Inherits:
Object
  • Object
show all
Defined in:
lib/database_documenter/exporters/base_exporter.rb

Direct Known Subclasses

ExportToMd, ExportToWord

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

Instance Method Summary collapse

Constructor Details

#initializeBaseExporter

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_countObject

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_countObject

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_tablesObject

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_dataObject

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_modelsObject



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

Returns:

  • (Boolean)


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