csv2md 1.1.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/csv2md +1 -1
  3. data/lib/csv2md.rb +3 -3
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 564147897190f473f82e69379e3a9626d7ee9e32
4
- data.tar.gz: 680f8a7d8c8a7b73473e33e57a8151f2218ba0b3
3
+ metadata.gz: 14c863a68dd0fc361df23464d60eaf4a2f1b13f3
4
+ data.tar.gz: 3adb1f7393c3afcf3dc4a5e99a16e8c0e08eca42
5
5
  SHA512:
6
- metadata.gz: f08f87dce0646df1133d48663becec752c8268dae66732bd123b7acb844e29650de5cf6bf2fcf70fd488eda68112681856de929f5073dbf27c1ad00d36e5d1cc
7
- data.tar.gz: f970bec4117ab833ffc6a21715de6c8162db515c70e59535a3fe91d14a58cb3380d8bcf47bc37677a1ab1f616941633cb188e5adafe22db75170a1761b8ac066
6
+ metadata.gz: 435f6d1c63eebf9ff37b18ac45d46e0b491b7e5375665f2b1ec2e82cfea11dc8b60f6e90779479d1e68feb7f15851b3823aec72b35151c8213eab07129a84777
7
+ data.tar.gz: 4cb4921b0fd9ec8c2a1de43ecb21b28b952a9a8de32fb707b0ea5306ff8be85f5abfc17a07b833b083fcdd425dc7c5dfd1b8a485be833254256b356f4ab92c51
data/bin/csv2md CHANGED
@@ -29,7 +29,7 @@ begin
29
29
  else
30
30
  while file_path = ARGV.shift
31
31
  input = File.read(file_path)
32
- csv2md = Csv2md.new(input: input)
32
+ csv2md = Csv2md.new(input)
33
33
  gfm += csv2md.send(output_format)
34
34
  gfm += "\n" if ARGV.length > 0
35
35
  end
@@ -12,7 +12,7 @@ class Csv2md
12
12
  def find_column_widths
13
13
  parsed_csv.inject(Array.new(parsed_csv[0].length, 0)) do |result, line|
14
14
  line.each_with_index do |column, i|
15
- if column.length > result[i]
15
+ if column.to_s.length > result[i]
16
16
  result[i] = column.length
17
17
  end
18
18
  end
@@ -31,7 +31,7 @@ class Csv2md
31
31
  parsed_csv.each_with_index do |line, row_index|
32
32
  line.each_with_index do |column, column_index|
33
33
  result += "| "
34
- result += column.ljust(widths[column_index] + 1, " ")
34
+ result += column.to_s.ljust(widths[column_index] + 1, " ")
35
35
  if column_index == number_of_columns - 1
36
36
  result += "|\n"
37
37
  end
@@ -49,7 +49,7 @@ class Csv2md
49
49
 
50
50
  def csv
51
51
  result = input.split("\n").map do |line|
52
- row = line.scan(/\|([^\|]+)\s/).flatten.map(&:strip).join(",")
52
+ row = line.scan(/\|([^\|]*)\s/).flatten.map(&:strip).join(",")
53
53
  row unless row.strip == ""
54
54
  end.compact.join("\n")
55
55
  result += "\n"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: csv2md
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Hoyt