Class: YahooQueryParser
- Inherits:
-
Object
- Object
- YahooQueryParser
- Defined in:
- lib/logstash/filters/parsers/yahoo.rb
Instance Method Summary collapse
-
#initialize ⇒ YahooQueryParser
constructor
A new instance of YahooQueryParser.
- #match(siteName) ⇒ Object
- #parse(query) ⇒ Object
Constructor Details
#initialize ⇒ YahooQueryParser
Returns a new instance of YahooQueryParser.
7 8 9 10 |
# File 'lib/logstash/filters/parsers/yahoo.rb', line 7 def initialize @re_url = /(?:[^\.]*\.)?search.yahoo\..*/ @re_query = /^\/search\?(?:[^&]*&)?p=(?<query>[^&#]*)/i end |
Instance Method Details
#match(siteName) ⇒ Object
13 14 15 |
# File 'lib/logstash/filters/parsers/yahoo.rb', line 13 def match(siteName) return @re_url.match(siteName) end |
#parse(query) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/logstash/filters/parsers/yahoo.rb', line 17 def parse(query) query = Utils.removeInvalidChars(query) m = @re_query.match(query) if m then return m["query"].tr("+", " ").split.join(" ") end end |