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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 94481d8db1ce663a1d86a8b92d43d29e45992f2fd9afd7152e744b110c1e823d
4
- data.tar.gz: cb027fdf6cc09d6881acfc32185532812de50f78cda8f443de7cee231fef49c7
3
+ metadata.gz: ab7231e5b7852690cc4f5bccd459ca4e68667aac565963c3d2869e3354babeb9
4
+ data.tar.gz: 976478a8e59a479fe702a23fb6567ada4a927eeda98b4f5fb75169c8f9a746a7
5
5
  SHA512:
6
- metadata.gz: 024e3f0118c12b8b7378a84cf496ab3029715e7bd22b084f6e71aeacb7f5ace11a2ab63c3c43580a01b7faf1261de3bbd06c00c569c4a6223cc233517e16d67e
7
- data.tar.gz: 6df8c7bb4cfdba147cac365776b73ba9943576912ef7a115125d95a47098a99888c215312088081b6e51c7b96469deb871644d3c5069e4c8b1b4082e639a3e3e
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
@@ -19,8 +19,8 @@ module TableFormat
19
19
  }
20
20
  end
21
21
 
22
- def self.generate(*args, &block)
23
- Generator.new(*args, &block).generate
22
+ def self.generate(*args, **options)
23
+ Generator.new(*args, **options).generate
24
24
  end
25
25
 
26
26
  class Generator
@@ -1,3 +1,3 @@
1
1
  module TableFormat
2
- VERSION = '0.0.6'
2
+ VERSION = '0.0.7'
3
3
  end
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.6
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: 2019-12-11 00:00:00.000000000 Z
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.0.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.