robostripper 0.0.2 → 0.0.3
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/README.rdoc +2 -1
- data/lib/robostripper/resource.rb +3 -2
- data/lib/robostripper/version.rb +1 -1
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
= Robostripper
|
2
2
|
|
3
|
-
Robostripper takes the magic of Nokogiri and makes it easy to treat a website
|
3
|
+
Robostripper takes the magic of Nokogiri and makes it easy to treat a website as though it actually provided a REST interface.
|
4
4
|
|
5
5
|
== Installation
|
6
6
|
|
@@ -109,3 +109,4 @@ If a block isn't given to an attribute definition in _add_list_ or _add_item_ th
|
|
109
109
|
<br /> elements to separate strings and you want to preserve the separation. For instance, if you want "123 Fake St<br />A City, CA" to have a space between the
|
110
110
|
street and the city.
|
111
111
|
* *:attribute* => 'href': Use this to pull out an element's specific attribute rather than it's inner text.
|
112
|
+
* *:strip* => true: By default, text results are stripped of preceeding whitespace/newlines. You can disable this by setting *:strip* to false. This option is ignored if *:all* is _true_.
|
@@ -53,11 +53,12 @@ module Robostripper
|
|
53
53
|
elsif result.nil? or result.length == 0
|
54
54
|
nil
|
55
55
|
elsif options.has_key? :nontext
|
56
|
-
result.children.select(&:text?).map(&:text).join(options[:nontext])
|
56
|
+
result = result.children.select(&:text?).map(&:text).join(options[:nontext])
|
57
|
+
options.fetch(:strip, true) ? result.strip : result
|
57
58
|
elsif options.has_key? :attribute
|
58
59
|
result.first[options[:attribute]]
|
59
60
|
else
|
60
|
-
result.text
|
61
|
+
options.fetch(:strip, true) ? result.text.strip : result.text
|
61
62
|
end
|
62
63
|
end
|
63
64
|
|
data/lib/robostripper/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: robostripper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Brian Muller
|
@@ -89,7 +89,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
89
89
|
requirements:
|
90
90
|
- - ">="
|
91
91
|
- !ruby/object:Gem::Version
|
92
|
-
hash:
|
92
|
+
hash: 3916270442267007939
|
93
93
|
segments:
|
94
94
|
- 0
|
95
95
|
version: "0"
|
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
98
|
requirements:
|
99
99
|
- - ">="
|
100
100
|
- !ruby/object:Gem::Version
|
101
|
-
hash:
|
101
|
+
hash: 3916270442267007939
|
102
102
|
segments:
|
103
103
|
- 0
|
104
104
|
version: "0"
|