table_pal 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f95417189c9c2c4f52b6f01538b23dafd8831d87f204f30261006cd0d43262c8
4
- data.tar.gz: 7bd18b009733e0442faf3a3cecb0018257a6eb7b1b08a3d7b8622c914a477529
3
+ metadata.gz: d59a604b123585e990bd5547ebf5adadeaf117cd66eecef1f0c4328e0c81c517
4
+ data.tar.gz: bdc46eeee259905af451ec8d5fd2490ac56f37834b7a5272af730cc04dbebf07
5
5
  SHA512:
6
- metadata.gz: 6771a4deffb3e214ab14ff93fef20b5fa503f35418874d27e3d7dd8a6367f191dfda064297dad5e7eefd8892ffb1ba81e65a21d3d05d0c4c4855f91dfe9917df
7
- data.tar.gz: fbec272fc84a48a056d54d64ce46c17fc16f6eaaccaa8af49161bb78ca1a8f5d460d7ef86ace1a5c9131efb6d3c2b95757a410164a1c1f96fc2f6b1f0d350340
6
+ metadata.gz: 221d7e69762f0808107e705214f204c793898b3c51d25dd4c6641f5f0749a148e4604049b45f4a1a2cc485d60c0fecd4b13785b3c2d01e9c71e4d5c700bdd63f
7
+ data.tar.gz: 02651b0128c61c87e5299cb93b7b49efaf7dec794abf22a6c11b630c32b18a8eab5031c0e9723f9934727eba870c3e6053372571ecbd6d85da7ea09af4bb6687
@@ -12,8 +12,8 @@ module TablePal
12
12
  attr_reader :row, :column, :content, :formatter, :justification, :colour
13
13
 
14
14
  def initialize(row:, column:, content: '', formatter: nil, justification: nil, colour: nil)
15
- @row = row
16
- @column = column
15
+ @row = row || (raise "Row must be supplied for cell with content: '#{content}' to exist in")
16
+ @column = column || (raise "Column must be supplied for cell with content: '#{content}' to exist in")
17
17
  @content = content
18
18
  @formatter = formatter || row.formatter || NoFormatting
19
19
  @justification = justification || row.justification || column.justification
@@ -12,7 +12,7 @@ module TablePal
12
12
  end
13
13
 
14
14
  def create_row(options = {})
15
- Validate.new(__method__, options)
15
+ Validate.new(__method__, options) if validations
16
16
 
17
17
  Row.new(options.merge(table: self)).tap do |row|
18
18
  @rows << row
@@ -14,16 +14,16 @@ module TablePal
14
14
  def validate_option(key, value)
15
15
  case key
16
16
  when :colour then validate(key: key, value: value, classes: [Symbol, NilClass])
17
- when :column then validate(key: key, value: value, classes: Column)
17
+ when :column then validate(key: key, value: value, classes: [Column])
18
18
  when :content then validate(key: key, value: value, classes: [String, Float, Integer, NilClass])
19
- when :formatter then validate(key: key, value: value, classes: Proc)
19
+ when :formatter then validate(key: key, value: value, classes: [Proc])
20
20
  when :heading then validate(key: key, value: value, classes: [TrueClass])
21
- when :justification then validate(key: key, value: value, classes: Symbol)
21
+ when :justification then validate(key: key, value: value, classes: [Symbol])
22
22
  when :left_border then validate(key: key, value: value, classes: [String, NilClass])
23
- when :left_padding then validate(key: key, value: value, classes: String)
23
+ when :left_padding then validate(key: key, value: value, classes: [String])
24
24
  when :right_border then validate(key: key, value: value, classes: [String, NilClass])
25
- when :right_padding then validate(key: key, value: value, classes: String)
26
- when :row then validate(key: key, value: value, classes: Row)
25
+ when :right_padding then validate(key: key, value: value, classes: [String])
26
+ when :row then validate(key: key, value: value, classes: [Row])
27
27
  when :subheading then validate(key: key, value: value, classes: [TrueClass, FalseClass])
28
28
  when :section_end then validate(key: key, value: value, classes: [TrueClass, FalseClass])
29
29
  else raise TablePalError, "#{class_method} received Unexpected option: `#{key}`"
@@ -31,8 +31,6 @@ module TablePal
31
31
  end
32
32
 
33
33
  def validate(key:, value:, classes:)
34
- classes = [classes].flatten
35
-
36
34
  return if classes.any? { |klass| value.is_a?(klass) }
37
35
 
38
36
  raise TablePalError, "#{class_method} expected `#{key}:` to be a #{for_sentence(classes)}, not a `#{value.class}`"
@@ -1,3 +1,3 @@
1
1
  module TablePal
2
- VERSION = '0.3.2'
2
+ VERSION = '0.3.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: table_pal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Lerner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-05 00:00:00.000000000 Z
11
+ date: 2019-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: interesting_methods