Class: TogoStanza::Stanza::SearchQuery
- Inherits:
-
Object
- Object
- TogoStanza::Stanza::SearchQuery
- Defined in:
- lib/togostanza/stanza/search_query.rb
Instance Attribute Summary collapse
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Instance Method Summary collapse
-
#initialize(query) ⇒ SearchQuery
constructor
A new instance of SearchQuery.
- #to_filter(method, var_name) ⇒ Object
- #tokens ⇒ Object
Constructor Details
#initialize(query) ⇒ SearchQuery
Returns a new instance of SearchQuery.
5 6 7 |
# File 'lib/togostanza/stanza/search_query.rb', line 5 def initialize(query) @raw = query end |
Instance Attribute Details
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
9 10 11 |
# File 'lib/togostanza/stanza/search_query.rb', line 9 def raw @raw end |
Instance Method Details
#to_filter(method, var_name) ⇒ Object
11 12 13 |
# File 'lib/togostanza/stanza/search_query.rb', line 11 def to_filter(method, var_name) "FILTER (#{to_clause(method, var_name)})" end |
#tokens ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/togostanza/stanza/search_query.rb', line 15 def tokens @tokens ||= begin scanner = StringScanner.new(@raw) scanner.skip /\s+/ parse(scanner) end end |