csvkit 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -20,7 +20,10 @@ class CSVKit
20
20
  doc.xpath('//table//tr').each do |row|
21
21
  tsv_row = []
22
22
  row.xpath('td | th').each do |cell|
23
- tsv_row << clean_cell_string(cell.text)
23
+ repeat = header_with_colspan?(cell) ? cell['colspan'].to_i : 1
24
+ repeat.times do
25
+ tsv_row << clean_cell_string(cell.text)
26
+ end
24
27
  end
25
28
  tsv << tsv_row
26
29
  end
@@ -43,6 +46,10 @@ class CSVKit
43
46
  is_numeric?(cell_string) ? cell_string.to_b : cell_string.strip
44
47
  end
45
48
 
49
+ def header_with_colspan?(cell)
50
+ 'th' == cell.name && cell.key?('colspan')
51
+ end
52
+
46
53
  def is_numeric?(string)
47
54
  return true if self =~ /^\d+$/
48
55
  true if Float(self) rescue false
@@ -1,3 +1,3 @@
1
1
  class CSVKit
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: csvkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: