markdown-tables 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +5 -5
  2. data/lib/markdown-tables.rb +18 -9
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: bb85037027b4ed9b6c064ef04ed5ad507ae20859
4
- data.tar.gz: f1d9d7230c5b4882d050e94d401264b35610c57f
2
+ SHA256:
3
+ metadata.gz: 32106fcf23ba3591f4330de1e9a6e1f4b45712371c23719a975a513fe1cd1940
4
+ data.tar.gz: 6a4199314024cf80d5babf546e6057118b56198eab7f634f7fe84730b4cc5efb
5
5
  SHA512:
6
- metadata.gz: a3aaa0e871716d174ee1530a5b4a1809bd3b88377f5a6393080e1b7f156594652ec96d69ad478c0e57e5361829a6965b06dc1a157233978f9ad0cbe2ac0f8c1b
7
- data.tar.gz: c772f17d33eac4696d1e5213d8d81d9bb607a3439757a52b664d6e427d35da6af17c4b19ac56b0c22007249c06f7d3c5bdcd2cf4ac3a3919a255c967924ff077
6
+ metadata.gz: a0bb9614c538cb22d194ab93f224d33becc20187fd93d490827e5f9180e89031f88b435b491716e13cbdda51366f7d49bd856cd31939c24ab34cac822332dd48
7
+ data.tar.gz: 30d151838b13904c1528eca4bde980e8bad49cf58f90d0c1e208cbbd9a5801c2e4ebc67c5754a8a3ec9381b80a2b9793252e8887e47f4647177b2a661fabac06
@@ -81,23 +81,32 @@ class MarkdownTables
81
81
  private_class_method def self.validate(labels, data, align, is_rows)
82
82
  if labels.class != Array
83
83
  raise('labels must be an array')
84
- elsif data.class != Array || data.any? {|datum| datum.class != Array}
84
+ end
85
+ if data.class != Array || data.any? {|datum| datum.class != Array}
85
86
  raise('data must be a two-dimensional array')
86
- elsif labels.empty?
87
+ end
88
+ if labels.empty?
87
89
  raise('No column labels given')
88
- elsif data.all? {|datum| datum.empty?}
90
+ end
91
+ if data.all? {|datum| datum.empty?}
89
92
  raise('No cells given')
90
- elsif labels.any? {|label| !label.respond_to?(:to_s)}
93
+ end
94
+ if labels.any? {|label| !label.respond_to?(:to_s)}
91
95
  raise('One or more column labels cannot be made into a string')
92
- elsif data.any? {|datum| datum.any? {|cell| !cell.respond_to?(:to_s)}}
96
+ end
97
+ if data.any? {|datum| datum.any? {|cell| !cell.respond_to?(:to_s)}}
93
98
  raise('One or more cells cannot be made into a string')
94
- elsif ![String, Array].include?(align.class)
99
+ end
100
+ if ![String, Array].include?(align.class)
95
101
  raise('align must be a string or array')
96
- elsif align.class == Array && align.any? {|val| val.class != String}
102
+ end
103
+ if align.class == Array && align.any? {|val| val.class != String}
97
104
  raise('One or more align values is not a string')
98
- elsif !is_rows && data.length > labels.length
105
+ end
106
+ if !is_rows && data.length > labels.length
99
107
  raise('Too many data columns given')
100
- elsif is_rows && data.any? {|row| row.length > labels.length}
108
+ end
109
+ if is_rows && data.any? {|row| row.length > labels.length}
101
110
  raise('One or more rows has too many cells')
102
111
  end
103
112
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: markdown-tables
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris de Graaf
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-19 00:00:00.000000000 Z
11
+ date: 2018-06-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: chrisadegraaf@gmail.com
@@ -37,7 +37,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
37
37
  version: '0'
38
38
  requirements: []
39
39
  rubyforge_project:
40
- rubygems_version: 2.6.8
40
+ rubygems_version: 2.7.6
41
41
  signing_key:
42
42
  specification_version: 4
43
43
  summary: Utilities for creating and displaying Markdown tables in Ruby