satoryu/google_suggest

View on GitHub
lib/google_suggest/parser.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
require 'rexml/document'

class GoogleSuggest
  class Parser
    def initialize(document)
      @document = REXML::Document.new(document)
    end

    def parse(path)
      REXML::XPath.match(@document, path).map do |node|
        node.attribute('data').value
      end
    end
  end
end