Class: DynamicModel::TablesAnalyser
- Inherits:
-
Object
- Object
- DynamicModel::TablesAnalyser
- Defined in:
- lib/database_introspection/dynamic_model/tables_analyser.rb
Instance Attribute Summary collapse
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
-
#klasses_analysed ⇒ Object
readonly
Returns the value of attribute klasses_analysed.
Instance Method Summary collapse
-
#initialize(domain, base_class = ActiveRecord::Base) ⇒ TablesAnalyser
constructor
A new instance of TablesAnalyser.
- #scan_database ⇒ Object
Constructor Details
#initialize(domain, base_class = ActiveRecord::Base) ⇒ TablesAnalyser
Returns a new instance of TablesAnalyser.
7 8 9 10 11 12 |
# File 'lib/database_introspection/dynamic_model/tables_analyser.rb', line 7 def initialize(domain, base_class = ActiveRecord::Base) @domain = domain @base_class = base_class define_domain_module @klasses_analysed = [] end |
Instance Attribute Details
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
5 6 7 |
# File 'lib/database_introspection/dynamic_model/tables_analyser.rb', line 5 def domain @domain end |
#klasses_analysed ⇒ Object (readonly)
Returns the value of attribute klasses_analysed.
5 6 7 |
# File 'lib/database_introspection/dynamic_model/tables_analyser.rb', line 5 def klasses_analysed @klasses_analysed end |
Instance Method Details
#scan_database ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/database_introspection/dynamic_model/tables_analyser.rb', line 14 def scan_database # Introspect database tables and creates ActiveRecord descendants in the name space module @domain_module.table_names.map do |table_name| inject_class table_name end @domain_module.model_classes end |