Class: KManager::Overview::Queries
- Inherits:
-
Object
- Object
- KManager::Overview::Queries
- Defined in:
- lib/k_manager/overview/queries.rb
Instance Attribute Summary collapse
-
#manager ⇒ Object
readonly
Returns the value of attribute manager.
Instance Method Summary collapse
- #areas ⇒ Object
-
#documents ⇒ Object
rubocop:disable Metrics/AbcSize.
-
#initialize(manager) ⇒ Queries
constructor
A new instance of Queries.
- #resources ⇒ Object
Constructor Details
#initialize(manager) ⇒ Queries
Returns a new instance of Queries.
8 9 10 |
# File 'lib/k_manager/overview/queries.rb', line 8 def initialize(manager) @manager = manager end |
Instance Attribute Details
#manager ⇒ Object (readonly)
Returns the value of attribute manager.
6 7 8 |
# File 'lib/k_manager/overview/queries.rb', line 6 def manager @manager end |
Instance Method Details
#areas ⇒ Object
12 13 14 |
# File 'lib/k_manager/overview/queries.rb', line 12 def areas manager.areas.map(&:attribute_values) end |
#documents ⇒ Object
rubocop:disable Metrics/AbcSize
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/k_manager/overview/queries.rb', line 30 def documents manager.areas.flat_map do |area| area.resource_manager.resource_set.resources.flat_map do |resource| resource.documents.map do |document| { **area.attribute_values('area_'), **resource.attribute_values('resource_'), document_id: document.object_id, document_state: document.block_state, document_data: document.data, document_key: document.key, document_namespace: document.namespace, document_tag: document.tag, document_type: document.type, document_errors: document.error_hash, document_valid: document.valid? } end end end end |
#resources ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/k_manager/overview/queries.rb', line 16 def resources manager.areas.flat_map do |area| # TODO: Some of these properties are only available on FileResource # This will need to be refactored when implementing Mem and Web Resource area.resource_manager.resource_set.resources.map do |resource| { **area.attribute_values('area_'), **resource.attribute_values('') } end end end |