table_format 0.0.7 → 0.0.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ab7231e5b7852690cc4f5bccd459ca4e68667aac565963c3d2869e3354babeb9
4
- data.tar.gz: 976478a8e59a479fe702a23fb6567ada4a927eeda98b4f5fb75169c8f9a746a7
3
+ metadata.gz: 0ecb4e366d0bfd3e4caa23c99eaf7ace891daec7da139485f2cf3de99dc52c81
4
+ data.tar.gz: 6d666359f1ec0610fa654b85d2593c876c3a51269f766224ced9f1dbc5038a0d
5
5
  SHA512:
6
- metadata.gz: 88571616e3d9fb6e4bd066c7b60b76774235bff0fd65c97d593a3ce114704cae44ba14f8038465208ef4722568c8f44f8863aeae3ddce097f9528f5201c43471
7
- data.tar.gz: 7319e86e2349b73d7ba5d708899328fc47d219d03054868e1de8be5be4b2dec1c5e93ea25232521f5ad4e9c711712b9624b2b0a1d544bc1773d09cf97ebf1ac5
6
+ metadata.gz: 37b58297e78496507612c9283a6613482c3cf618543f8f9dd234037e230fe09aac779685d6017955137b57acd4ea6c71d0cdfabac3cd8b40937f72d97a788a1f
7
+ data.tar.gz: cb033b6dbb6feff4b4fb61a58cca047c8a095f47811830837ccca8180b2abee9b2d58704065cd8747a159bc7739569fbb41468a39cba8f0a02c7a3b34c325c7d
@@ -11,7 +11,7 @@ else
11
11
  ::ActiveRecord::Result.include(TableFormat::ActiveRecordResult)
12
12
 
13
13
  ::ActiveRecord::Relation.class_eval do
14
- def to_t(**options)
14
+ def to_t(options = {})
15
15
  TableFormat.generate(to_a.collect(&:attributes), options)
16
16
  end
17
17
  end
@@ -3,36 +3,36 @@ require 'active_support/core_ext/kernel/concern'
3
3
  module TableFormat
4
4
  concern :ActiveRecord do
5
5
  class_methods do
6
- def to_t(**options)
7
- TableFormat.generate(all.collect(&:attributes), **options)
6
+ def to_t(options = {})
7
+ TableFormat.generate(all.collect(&:attributes), options)
8
8
  end
9
9
  end
10
10
 
11
- def to_t(**options)
12
- TableFormat.generate(attributes, **options)
11
+ def to_t(options = {})
12
+ TableFormat.generate(attributes, options)
13
13
  end
14
14
  end
15
15
 
16
16
  concern :ActiveRecordResult do
17
- def to_t(**options)
18
- TableFormat.generate(collect(&:to_h), **options)
17
+ def to_t(options = {})
18
+ TableFormat.generate(collect(&:to_h), options)
19
19
  end
20
20
  end
21
21
  end
22
22
 
23
23
  Object.class_eval do
24
- def to_t(**options)
24
+ def to_t(options = {})
25
25
  case
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
37
  TableFormat.generate([{self.class.name => self}], **{header: false}.merge(options))
38
38
  end
@@ -42,33 +42,33 @@ end
42
42
  Kernel.class_eval do
43
43
  private
44
44
 
45
- def tp(object, **options)
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
- def table_format(object, **options)
52
- object.to_t(**options)
51
+ def table_format(object, options = {})
52
+ object.to_t(options)
53
53
  end
54
54
  end
55
55
 
56
56
  Array.class_eval do
57
- def to_t(**options)
58
- TableFormat.generate(self, **options)
57
+ def to_t(options = {})
58
+ TableFormat.generate(self, options)
59
59
  end
60
60
  end
61
61
 
62
62
  Hash.class_eval do
63
- def to_t(**options)
64
- TableFormat.generate(self, **options)
63
+ def to_t(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
- def to_t(**options)
71
- TableFormat.generate([{self.class.name => self}], **{header: false}.merge(options))
70
+ def to_t(options = {})
71
+ TableFormat.generate([{self.class.name => self}], {header: false}.merge(options))
72
72
  end
73
73
  end
74
74
  end
@@ -19,12 +19,12 @@ module TableFormat
19
19
  }
20
20
  end
21
21
 
22
- def self.generate(*args, **options)
23
- Generator.new(*args, **options).generate
22
+ def self.generate(rows, options = {})
23
+ Generator.new(rows, options).generate
24
24
  end
25
25
 
26
26
  class Generator
27
- def initialize(rows, **options)
27
+ def initialize(rows, options = {})
28
28
  @options = TableFormat.default_options.merge(options)
29
29
 
30
30
  if @options[:markdown]
@@ -6,7 +6,7 @@ module TableFormat
6
6
  ::ActiveRecord::Result.include TableFormat::ActiveRecordResult
7
7
 
8
8
  ::ActiveRecord::Relation.class_eval do
9
- def to_t(**options)
9
+ def to_t(options = {})
10
10
  TableFormat.generate(to_a.collect(&:attributes), options)
11
11
  end
12
12
  end
@@ -1,3 +1,3 @@
1
1
  module TableFormat
2
- VERSION = '0.0.7'
2
+ VERSION = '0.0.8'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: table_format
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - akicho8