Class: Underpass::QL::QueryAnalyzer
- Inherits:
-
Object
- Object
- Underpass::QL::QueryAnalyzer
- Defined in:
- lib/underpass/ql/query_analyzer.rb
Overview
Constant Summary collapse
- MATCH_TYPES =
Returns the recognized OSM element types.
%w[node way relation].freeze
Instance Method Summary collapse
-
#initialize(query) ⇒ QueryAnalyzer
constructor
Creates a new analyzer for the given query string.
-
#requested_types ⇒ Array<String>
Returns the element types requested in the query.
Constructor Details
#initialize(query) ⇒ QueryAnalyzer
Creates a new analyzer for the given query string.
16 17 18 |
# File 'lib/underpass/ql/query_analyzer.rb', line 16 def initialize(query) @query = query end |
Instance Method Details
#requested_types ⇒ Array<String>
Returns the element types requested in the query.
Falls back to all types when the query is empty or contains no recognized type keywords.
26 27 28 29 30 31 |
# File 'lib/underpass/ql/query_analyzer.rb', line 26 def requested_types return MATCH_TYPES if empty_query? types = parse_types_from_query types.empty? ? MATCH_TYPES : types end |