webpage 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/lib/webpage.rb CHANGED
@@ -37,6 +37,9 @@ class Webpage
37
37
  def nodes_with(key)
38
38
  @nokogiri.xpath("//@#{key}")
39
39
  end
40
+ def xpath(xstring)
41
+ @nokogiri.xpath(xstring)
42
+ end
40
43
 
41
44
  def keywords
42
45
  @keywords ||= @nokogiri.xpath("//meta[@name='keywords']").map{|meta|meta['content']}.flatten.join.split(',')
data/spec/webpage_spec.rb CHANGED
@@ -38,6 +38,9 @@ describe Webpage do
38
38
  it "nodes_with should return an array with elements Nokogiri::XML::NodeSet" do
39
39
  page.nodes_with('id').class.should == Nokogiri::XML::NodeSet
40
40
  end
41
+ it "xpath should return an array with elements Nokogiri::XML::NodeSet" do
42
+ page.xpath('//id').class.should == Nokogiri::XML::NodeSet
43
+ end
41
44
  it "links' elements should be Webpage::Link" do
42
45
  page.links.each do |link|
43
46
  link.class.should == Nokogiri::XML::Element
data/webpage.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{webpage}
3
- s.version = '0.0.7'
3
+ s.version = '0.0.8'
4
4
  s.authors = ["seoaqua"]
5
5
  s.date = %q{2012-07-29}
6
6
  s.description = %q{a tool to extract some basic data from a webpage}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webpage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: