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 +4 -4
- data/lib/horsefield/node.rb +6 -1
- data/lib/horsefield/node_set.rb +1 -1
- data/lib/horsefield/scraper.rb +2 -2
- data/lib/horsefield/version.rb +1 -1
- data/spec/scraper_spec.rb +2 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2cfb5049fcbda71817b68f0ba6359a6a2794afdc
|
|
4
|
+
data.tar.gz: 2d3c26b593f8a05e6510522f805c3185815a59fc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d3edbb36a1e8fd05e3306e14f0f7ca54f9ab9d715afcb64c4440507a0808e721f5790343fb23d16f61d343f183cc37da06ea0bc62f04261fa7ee6bf680e76ffd
|
|
7
|
+
data.tar.gz: e60f5aef998f9228cc3ddc493d3206c408b32fa3b7221199d6e2ad80bb0658bcb7145c09cbf0615a32f39e948548e2861f2efed95e7fc2e4da7f1f2633d9c84b
|
data/lib/horsefield/node.rb
CHANGED
|
@@ -6,7 +6,12 @@ module Horsefield
|
|
|
6
6
|
end
|
|
7
7
|
|
|
8
8
|
def process
|
|
9
|
-
@html
|
|
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
|
data/lib/horsefield/node_set.rb
CHANGED
data/lib/horsefield/scraper.rb
CHANGED
data/lib/horsefield/version.rb
CHANGED
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/
|
|
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
|