as_foo 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/as_foo/as_html.rb +18 -0
- data/lib/as_foo/version.rb +1 -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: c8de3a11e04f746a2d53eb97928d39a6c6d07919
|
4
|
+
data.tar.gz: 9465d20087508d53be79dfc29cac2c5db7ef5aa0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51c723d2f44906c77456200e8ee4b7d8a6435421a8c13c345f35136ee7aacf283602fc943659b3719c976aa577ae956d45fc9a94ab5967bff20bc00453bbd05b
|
7
|
+
data.tar.gz: d4f7ebe561669887c46683975cbda3154947aafdf006a2a9981c56839305de15b3e21edeffb1e4543576fe23f934ef54ad0d3d488c466cdef325c4e895a2c215
|
data/lib/as_foo/as_html.rb
CHANGED
@@ -1,11 +1,29 @@
|
|
1
|
+
require 'tempfile'
|
2
|
+
|
1
3
|
module AsFoo
|
2
4
|
module AsHtml
|
5
|
+
# @return [String] converted string
|
3
6
|
def as_html(with: :w3m, options: nil)
|
4
7
|
case with
|
5
8
|
when :w3m
|
6
9
|
IO.popen("w3m -dump -T text/html", "w") do |w3m|
|
7
10
|
w3m.puts self.to_s
|
8
11
|
end
|
12
|
+
when :lynx
|
13
|
+
IO.popen("lynx -dump -nonumbers -nolist -stdin", "w") do |lynx|
|
14
|
+
lynx.puts self.to_s
|
15
|
+
end
|
16
|
+
when :links
|
17
|
+
Tempfile.open ["as_foo", ".html"] do |src|
|
18
|
+
src.puts self.to_s
|
19
|
+
src.flush
|
20
|
+
|
21
|
+
`links -dump #{src.path}`
|
22
|
+
end
|
23
|
+
when :elinks
|
24
|
+
IO.popen("elinks -dump -no-numbering -no-references", "w") do |elinks|
|
25
|
+
elinks.puts self.to_s
|
26
|
+
end
|
9
27
|
else
|
10
28
|
raise ArgumentError.new("unexpected method #{with}")
|
11
29
|
end
|
data/lib/as_foo/version.rb
CHANGED