graboid 0.2.0 → 0.2.1
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.
- data/VERSION +1 -1
- data/graboid.gemspec +66 -0
- data/lib/graboid/entity.rb +4 -1
- data/spec/graboid/entity_spec.rb +0 -1
- metadata +4 -3
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.2.
|
|
1
|
+
0.2.1
|
data/graboid.gemspec
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Generated by jeweler
|
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
|
4
|
+
# -*- encoding: utf-8 -*-
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |s|
|
|
7
|
+
s.name = %q{graboid}
|
|
8
|
+
s.version = "0.2.1"
|
|
9
|
+
|
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
|
+
s.authors = ["Christopher Burnett"]
|
|
12
|
+
s.date = %q{2010-06-11}
|
|
13
|
+
s.description = %q{web scraping made easier}
|
|
14
|
+
s.email = %q{signalstatic@gmail.com}
|
|
15
|
+
s.extra_rdoc_files = [
|
|
16
|
+
"LICENSE",
|
|
17
|
+
"README.mdown"
|
|
18
|
+
]
|
|
19
|
+
s.files = [
|
|
20
|
+
".document",
|
|
21
|
+
".gitignore",
|
|
22
|
+
"LICENSE",
|
|
23
|
+
"README.mdown",
|
|
24
|
+
"Rakefile",
|
|
25
|
+
"VERSION",
|
|
26
|
+
"graboid.gemspec",
|
|
27
|
+
"lib/graboid.rb",
|
|
28
|
+
"lib/graboid/entity.rb",
|
|
29
|
+
"spec/fixtures/graboid.jpg",
|
|
30
|
+
"spec/fixtures/posts.html",
|
|
31
|
+
"spec/graboid/entity_spec.rb",
|
|
32
|
+
"spec/graboid_spec.rb",
|
|
33
|
+
"spec/spec.opts",
|
|
34
|
+
"spec/spec_helper.rb"
|
|
35
|
+
]
|
|
36
|
+
s.homepage = %q{http://github.com/twoism/graboid}
|
|
37
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
|
38
|
+
s.require_paths = ["lib"]
|
|
39
|
+
s.rubygems_version = %q{1.3.7}
|
|
40
|
+
s.summary = %q{web scraping made easy}
|
|
41
|
+
s.test_files = [
|
|
42
|
+
"spec/graboid/entity_spec.rb",
|
|
43
|
+
"spec/graboid_spec.rb",
|
|
44
|
+
"spec/spec_helper.rb"
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
if s.respond_to? :specification_version then
|
|
48
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
|
49
|
+
s.specification_version = 3
|
|
50
|
+
|
|
51
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
52
|
+
s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
|
|
53
|
+
s.add_runtime_dependency(%q<nokogiri>, [">= 0"])
|
|
54
|
+
s.add_runtime_dependency(%q<activesupport>, [">= 0"])
|
|
55
|
+
else
|
|
56
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
|
57
|
+
s.add_dependency(%q<nokogiri>, [">= 0"])
|
|
58
|
+
s.add_dependency(%q<activesupport>, [">= 0"])
|
|
59
|
+
end
|
|
60
|
+
else
|
|
61
|
+
s.add_dependency(%q<rspec>, [">= 1.2.9"])
|
|
62
|
+
s.add_dependency(%q<nokogiri>, [">= 0"])
|
|
63
|
+
s.add_dependency(%q<activesupport>, [">= 0"])
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
data/lib/graboid/entity.rb
CHANGED
|
@@ -53,7 +53,10 @@ module Graboid
|
|
|
53
53
|
def hash_map fragment
|
|
54
54
|
attribute_map.inject({}) do |extracted_hash, at|
|
|
55
55
|
selector, processor = at.last[:selector], at.last[:processor]
|
|
56
|
-
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
extracted_hash[at.first] = processor.nil? ? fragment.css(selector).first.text : processor.call(fragment.css(selector).first) rescue ""
|
|
59
|
+
|
|
57
60
|
extracted_hash
|
|
58
61
|
end
|
|
59
62
|
end
|
data/spec/graboid/entity_spec.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: graboid
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 21
|
|
5
5
|
prerelease: false
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 2
|
|
9
|
-
-
|
|
10
|
-
version: 0.2.
|
|
9
|
+
- 1
|
|
10
|
+
version: 0.2.1
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Christopher Burnett
|
|
@@ -78,6 +78,7 @@ files:
|
|
|
78
78
|
- README.mdown
|
|
79
79
|
- Rakefile
|
|
80
80
|
- VERSION
|
|
81
|
+
- graboid.gemspec
|
|
81
82
|
- lib/graboid.rb
|
|
82
83
|
- lib/graboid/entity.rb
|
|
83
84
|
- spec/fixtures/graboid.jpg
|