Class: FogTracker::Query::QueryProcessor
- Inherits:
-
Object
- Object
- FogTracker::Query::QueryProcessor
- Defined in:
- lib/fog_tracker/query/query_processor.rb
Overview
A class for filtering the Fog resources for a set of AccountTrackers, based on a regular-expression-based query
Constant Summary collapse
- QUERY_PATTERN =
The Regular Expression which all resource queries must match
%r{(.*)::(.*)::(.*)::(.*)}
Instance Method Summary collapse
-
#execute(query) ⇒ Array <Fog::Model>
Uses the query string to filter all polled resources for a desired subset.
-
#initialize(trackers, options = {}) ⇒ QueryProcessor
constructor
Creates an object for filtering Resources from a set of AccountTrackers.
Constructor Details
#initialize(trackers, options = {}) ⇒ QueryProcessor
Creates an object for filtering Resources from a set of AccountTrackers
14 15 16 17 |
# File 'lib/fog_tracker/query/query_processor.rb', line 14 def initialize(trackers, ={}) @trackers = trackers @log = [:logger] || FogTracker.default_logger end |
Instance Method Details
#execute(query) ⇒ Array <Fog::Model>
Uses the query string to filter all polled resources for a desired subset
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/fog_tracker/query/query_processor.rb', line 23 def execute(query) acct_pattern, svc_pattern, prov_pattern, col_pattern = parse_query(query) filter_by_collection( filter_by_provider( filter_by_service( attach_query_methods(get_results_by_account(acct_pattern)), svc_pattern), prov_pattern), col_pattern) end |