helium-console 0.1.4 → 0.1.5

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: 0d7b3d187641aabf02e4a6971fcc115c28d513fa46ce8532ded30f0a372b4a72
4
- data.tar.gz: b81ba7655d8e2f80db96b87ee22d3e5e529cf49628813ba4ca8a41cff3362126
3
+ metadata.gz: 6cc078f13cb540c2c2c9d14814cfe31da3b50ebdb59051918db1ac3d3fc63b51
4
+ data.tar.gz: c9fd23846bad166de9fd715c4166e60a162df08a6f820277c0815f539dac6306
5
5
  SHA512:
6
- metadata.gz: 1d128544877758a58ac1d98042c50cbe5d10452d37b57b8422de7eb2143dfa22498be54a37c2c7b0f1a301c8032e7e30e5b95d7d5d5ba72f191412be4c9b1d3f
7
- data.tar.gz: d5f528534253ae54e0dff195216284d9ff9033affc5afbbb9f2849972aa0f84ad2e4538da6487e9bd4a4f72c7ada036783af13f90658d85f7913c80e94c13e62
6
+ metadata.gz: 9259047186f54a53e8378d8fc0c94c35a895334acfb97950ba22511453aa4a0b855866c94d22b323c2249847cf112bcec126ef63ec0c71764fc3dce6c8038213
7
+ data.tar.gz: 475285e8aae66982bfc86cf3250fbb6e97f88eddf7e7c14228b7158fd8694981c227cc8185e9794869d1c0be27ae6a7f97b789e15269c61a575c850a64ad1263
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- helium-console (0.1.4)
4
+ helium-console (0.1.5)
5
5
  colorize
6
6
  pry
7
7
 
@@ -0,0 +1,16 @@
1
+ module Helium
2
+ class Console
3
+ define_formatter_for Module do
4
+ def call
5
+ light_yellow(object.name || anonymus_text)
6
+ end
7
+
8
+ private
9
+
10
+ def anonymus_text
11
+ closest = object.ancestors.find(&:name).name
12
+ "(ananymus #{closest})"
13
+ end
14
+ end
15
+ end
16
+ end
@@ -16,9 +16,9 @@ module Helium
16
16
  end
17
17
 
18
18
  [
19
- "#{light_black('#')} #{light_yellow(object.class.name)} instance",
20
- format(table, **options),
21
- ].join($/)
19
+ table_header,
20
+ format(table),
21
+ ].reject(&:empty?).join($/)
22
22
  end
23
23
 
24
24
  def format_inline_with_truncation
@@ -27,13 +27,12 @@ module Helium
27
27
 
28
28
  def format_inline_with_no_truncation
29
29
  joined = nil
30
- one_complex = false
31
30
 
32
31
  object.each do |key, value|
33
32
  return unless simple?(value)
34
33
 
35
- formatted_key = format(key, max_lines: 1, nesting: 1, max_with: 15)
36
- formatted_value = format(value, max_lines: 1, nesting: 1, max_width: 15)
34
+ formatted_key = format(key, level: 3, max_with: 15)
35
+ formatted_value = format(value, level: 3, max_width: 15)
37
36
  formatted = "#{formatted_key} => #{formatted_value}"
38
37
 
39
38
  joined = [joined, formatted].compact.join(", ")
@@ -44,8 +43,17 @@ module Helium
44
43
  ["{", joined, "}"].compact.join
45
44
  end
46
45
 
46
+ def table_header
47
+ type = case object
48
+ when Class then :class
49
+ when Module then :module
50
+ else :instance
51
+ end
52
+ "#{light_black('#')} #{light_yellow(type == :instance ? object.class.name : object.name)} #{type}"
53
+ end
54
+
47
55
  def force_inline?
48
- (max_lines && max_lines < 5) || level > 2
56
+ level > 2
49
57
  end
50
58
 
51
59
  def all_symbol?
@@ -1,5 +1,5 @@
1
1
  module Helium
2
2
  class Console
3
- VERSION = "0.1.4"
3
+ VERSION = "0.1.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: helium-console
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stanislaw Klajn
@@ -67,6 +67,7 @@ files:
67
67
  - lib/helium/console/registry/array.rb
68
68
  - lib/helium/console/registry/booleans.rb
69
69
  - lib/helium/console/registry/hash.rb
70
+ - lib/helium/console/registry/module.rb
70
71
  - lib/helium/console/registry/nil.rb
71
72
  - lib/helium/console/registry/numeric.rb
72
73
  - lib/helium/console/registry/object.rb