horsefield 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 909d1fbaae07e72abcbfc56411f56eb13cdf3fb6
4
- data.tar.gz: ad10de7bd9e695deac3b849be8aa643208253b44
3
+ metadata.gz: 2cfb5049fcbda71817b68f0ba6359a6a2794afdc
4
+ data.tar.gz: 2d3c26b593f8a05e6510522f805c3185815a59fc
5
5
  SHA512:
6
- metadata.gz: 8d84f4e592ca0380e20515e7b1f8ea43c66931443c9ede76b89ac0ba6061bb3bc4ddeabb6774fc8147a1bc271d4756b50c532a09e7d38714c4d9b21c54b40500
7
- data.tar.gz: e06816739c97b086416c7ee544506203d5607d85dd4c497b63886c501d065cc01f308e64499ea90f64ef23a333e4e4396a10f7501cb3c5d221479c49b75cda1e
6
+ metadata.gz: d3edbb36a1e8fd05e3306e14f0f7ca54f9ab9d715afcb64c4440507a0808e721f5790343fb23d16f61d343f183cc37da06ea0bc62f04261fa7ee6bf680e76ffd
7
+ data.tar.gz: e60f5aef998f9228cc3ddc493d3206c408b32fa3b7221199d6e2ad80bb0658bcb7145c09cbf0615a32f39e948548e2861f2efed95e7fc2e4da7f1f2633d9c84b
@@ -6,7 +6,12 @@ module Horsefield
6
6
  end
7
7
 
8
8
  def process
9
- @html.search('text()').to_s.split.join ' '
9
+ case @html
10
+ when Nokogiri::XML::Element then
11
+ @html.search('text()').to_s.split.join ' '
12
+ when Nokogiri::XML::Attr then
13
+ @html.value
14
+ end
10
15
  end
11
16
  end
12
17
  end
@@ -13,7 +13,7 @@ module Horsefield
13
13
  @nodes
14
14
  end
15
15
 
16
- def browse(*args)
16
+ def browse(*)
17
17
  end
18
18
 
19
19
  def one(name, selector, &block)
@@ -20,10 +20,10 @@ module Horsefield
20
20
  browser.instance_eval &block
21
21
  end
22
22
 
23
- def one(*args)
23
+ def one(*)
24
24
  end
25
25
 
26
- def many(*args)
26
+ def many(*)
27
27
  end
28
28
 
29
29
  def page
@@ -1,3 +1,3 @@
1
1
  module Horsefield
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
data/spec/scraper_spec.rb CHANGED
@@ -34,8 +34,9 @@ describe Horsefield::Scraper do
34
34
  it 'works with Watir' do
35
35
  browser = Watir::Browser.new :phantomjs
36
36
 
37
- result = Horsefield::Scraper.new(browser).scrape 'https://github.com/apa512' do
37
+ result = Horsefield::Scraper.new(browser).scrape 'https://github.com/cowboy' do
38
38
  one :email, 'a.email'
39
+ many :organizations, '//div[@class="orgs"]//@original-title'
39
40
  end
40
41
 
41
42
  p result
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: horsefield
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erik Strömberg