rbbt-util 5.19.3 → 5.19.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/rbbt/tsv/excel.rb +11 -0
- 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: b545dcabe313bcc581d9a9b94d049c9284ca86f2
|
4
|
+
data.tar.gz: 43d627ab5b4cb8051266611d47641b1c9490437f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf44baad72af53306e6f8f7b44891ddddbcacfdaf7f86018d4bd890a6f807640eb72e548e3dae5d287f6e5491744cfc0f09c13cac3626f8c6e3870690b3041d9
|
7
|
+
data.tar.gz: 8468421e72fd40d85424c0e096efed24859121623880681b1fda0810e7d3bec08096fe5572f6a75dd89708f2a6da41a89103cfe92145f50789922b18690da4e7
|
data/lib/rbbt/tsv/excel.rb
CHANGED
@@ -46,10 +46,19 @@ module TSV
|
|
46
46
|
book.write filename
|
47
47
|
end
|
48
48
|
|
49
|
+
def remove_link(value)
|
50
|
+
if value =~ /<([\w]+)[^>]*>(.*?)<\/\1>/
|
51
|
+
$2
|
52
|
+
else
|
53
|
+
value
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
49
57
|
def excel(filename, options ={})
|
50
58
|
name = Misc.process_options options, :name
|
51
59
|
sort_by = Misc.process_options options, :sort_by
|
52
60
|
sort_by_cast = Misc.process_options options, :sort_by_cast
|
61
|
+
remove_links = Misc.process_options options, :remove_links
|
53
62
|
|
54
63
|
book = Spreadsheet::Workbook.new
|
55
64
|
sheet1 = book.create_worksheet
|
@@ -79,8 +88,10 @@ module TSV
|
|
79
88
|
values.each do |value|
|
80
89
|
v = (name and value.respond_to?(:name)) ? value.name || value : value
|
81
90
|
if Array === v
|
91
|
+
v = v.collect{|_v| remove_link(_v)} if remove_links
|
82
92
|
cells.push v * ", "
|
83
93
|
else
|
94
|
+
v = remove_link(v) if remove_links
|
84
95
|
cells.push v
|
85
96
|
end
|
86
97
|
end
|