Class: Mxrb::Oql::Catalog
- Inherits:
-
Object
- Object
- Mxrb::Oql::Catalog
- Defined in:
- lib/mxrb/oql.rb
Overview
Finds OQL-bearing native model elements without treating arbitrary strings as queries.
Instance Method Summary collapse
-
#initialize(project) ⇒ Catalog
constructor
A new instance of Catalog.
- #queries ⇒ Object
Constructor Details
#initialize(project) ⇒ Catalog
Returns a new instance of Catalog.
31 32 33 |
# File 'lib/mxrb/oql.rb', line 31 def initialize(project) @project = project end |
Instance Method Details
#queries ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/mxrb/oql.rb', line 35 def queries @queries ||= begin units = @project.all_units units_by_id = units.to_h { [_1['UnitID'], _1] } module_by_id = @project.modules.to_h { [_1.id, _1.name] } units.flat_map do |raw| document = @project.parse_bson(raw) module_name = ancestor_module(raw, units_by_id, module_by_id) discover(document, raw, module_name) end.sort_by(&:qualified_name).freeze end end |