Class: Webinfo

Inherits:
Object
  • Object
show all
Defined in:
lib/webinfo.rb,
lib/webinfo/version.rb

Constant Summary collapse

VERSION =
"0.1.2"

Class Method Summary collapse

Class Method Details

.get_info(addr, options = {}) ⇒ Object

addr - site address options - ,:attr



8
9
10
11
12
13
# File 'lib/webinfo.rb', line 8

def self.get_info(addr, options = {})
  response = HTTParty.get(addr)
  doc = Nokogiri::HTML(response)
  nodes = doc.xpath("//#{options[:node]}")
  nodes.map {|i| i[options[:attr]]}.compact.uniq
end