Class: TogoStanza::Stanza::SearchQuery

Inherits:
Object
  • Object
show all
Defined in:
lib/togostanza/stanza/search_query.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#rawObject (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

#tokensObject



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