table_format 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/table_format/core_ext.rb +12 -12
- data/lib/table_format/generator.rb +2 -2
- data/lib/table_format/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab7231e5b7852690cc4f5bccd459ca4e68667aac565963c3d2869e3354babeb9
|
4
|
+
data.tar.gz: 976478a8e59a479fe702a23fb6567ada4a927eeda98b4f5fb75169c8f9a746a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88571616e3d9fb6e4bd066c7b60b76774235bff0fd65c97d593a3ce114704cae44ba14f8038465208ef4722568c8f44f8863aeae3ddce097f9528f5201c43471
|
7
|
+
data.tar.gz: 7319e86e2349b73d7ba5d708899328fc47d219d03054868e1de8be5be4b2dec1c5e93ea25232521f5ad4e9c711712b9624b2b0a1d544bc1773d09cf97ebf1ac5
|
@@ -4,18 +4,18 @@ module TableFormat
|
|
4
4
|
concern :ActiveRecord do
|
5
5
|
class_methods do
|
6
6
|
def to_t(**options)
|
7
|
-
TableFormat.generate(all.collect(&:attributes), options)
|
7
|
+
TableFormat.generate(all.collect(&:attributes), **options)
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
11
|
def to_t(**options)
|
12
|
-
TableFormat.generate(attributes, options)
|
12
|
+
TableFormat.generate(attributes, **options)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
16
|
concern :ActiveRecordResult do
|
17
17
|
def to_t(**options)
|
18
|
-
TableFormat.generate(collect(&:to_h), options)
|
18
|
+
TableFormat.generate(collect(&:to_h), **options)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -26,15 +26,15 @@ Object.class_eval do
|
|
26
26
|
when respond_to?(:to_a)
|
27
27
|
if false
|
28
28
|
if to_a.first.respond_to?(:attributes)
|
29
|
-
return to_a.collect(&:attributes).to_t(options)
|
29
|
+
return to_a.collect(&:attributes).to_t(**options)
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
to_a.to_t(options)
|
33
|
+
to_a.to_t(**options)
|
34
34
|
when respond_to?(:to_h)
|
35
|
-
to_h.to_t(options)
|
35
|
+
to_h.to_t(**options)
|
36
36
|
else
|
37
|
-
TableFormat.generate([{self.class.name => self}], {header: false}.merge(options))
|
37
|
+
TableFormat.generate([{self.class.name => self}], **{header: false}.merge(options))
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
@@ -44,31 +44,31 @@ Kernel.class_eval do
|
|
44
44
|
|
45
45
|
def tp(object, **options)
|
46
46
|
object.tap do
|
47
|
-
table_format(object, options).display
|
47
|
+
table_format(object, **options).display
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
51
|
def table_format(object, **options)
|
52
|
-
object.to_t(options)
|
52
|
+
object.to_t(**options)
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
56
|
Array.class_eval do
|
57
57
|
def to_t(**options)
|
58
|
-
TableFormat.generate(self, options)
|
58
|
+
TableFormat.generate(self, **options)
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
62
|
Hash.class_eval do
|
63
63
|
def to_t(**options)
|
64
|
-
TableFormat.generate(self, options)
|
64
|
+
TableFormat.generate(self, **options)
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
68
|
[Symbol, String, Numeric].each do |klass|
|
69
69
|
klass.class_eval do
|
70
70
|
def to_t(**options)
|
71
|
-
TableFormat.generate([{self.class.name => self}], {header: false}.merge(options))
|
71
|
+
TableFormat.generate([{self.class.name => self}], **{header: false}.merge(options))
|
72
72
|
end
|
73
73
|
end
|
74
74
|
end
|
data/lib/table_format/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: table_format
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- akicho8
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
148
|
- !ruby/object:Gem::Version
|
149
149
|
version: '0'
|
150
150
|
requirements: []
|
151
|
-
rubygems_version: 3.
|
151
|
+
rubygems_version: 3.1.2
|
152
152
|
signing_key:
|
153
153
|
specification_version: 4
|
154
154
|
summary: TableFormat shows text table like emacs org-table for easy reading.
|