table_pal 0.3.2 → 0.3.3
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/cell.rb +2 -2
- data/lib/table.rb +1 -1
- data/lib/validate.rb +6 -8
- data/lib/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d59a604b123585e990bd5547ebf5adadeaf117cd66eecef1f0c4328e0c81c517
|
4
|
+
data.tar.gz: bdc46eeee259905af451ec8d5fd2490ac56f37834b7a5272af730cc04dbebf07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 221d7e69762f0808107e705214f204c793898b3c51d25dd4c6641f5f0749a148e4604049b45f4a1a2cc485d60c0fecd4b13785b3c2d01e9c71e4d5c700bdd63f
|
7
|
+
data.tar.gz: 02651b0128c61c87e5299cb93b7b49efaf7dec794abf22a6c11b630c32b18a8eab5031c0e9723f9934727eba870c3e6053372571ecbd6d85da7ea09af4bb6687
|
data/lib/cell.rb
CHANGED
@@ -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
|
data/lib/table.rb
CHANGED
data/lib/validate.rb
CHANGED
@@ -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}`"
|
data/lib/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2019-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: interesting_methods
|