debugtrace 0.2.1 → 0.2.2

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: 45808a8d698423fb10b4b53bf1a0152b747a85a2ae32bab2ac42aff32a5252ed
4
- data.tar.gz: 6a0aeb4db13f194c971b974110ee03b21e8dbb2baab8840a5c9a820142d4e05c
3
+ metadata.gz: 5937a3c3f6b9d19ab3bb040ef763ada32e262c5046532331a7082f3edc3128cb
4
+ data.tar.gz: 31b5c3027993f50d06409ec9c54d55adff5e68563a8f02b66ae6e618027ec550
5
5
  SHA512:
6
- metadata.gz: 79b136be33532e002ab16bf327519d13567e50d49ab4d4fecfc3dfb588b207ae70cc55cf6fc89b4a51649e100dcb38f808f648326882487813ea01d9779dc735
7
- data.tar.gz: 27e016acdd8748683c8afc0639be04b9efa2dffe593a9a8a714c849bfdcfeb86dbd7e9c1d0e133b72687636812b02730dadf2ff651fb53d6b592001b443e1cb9
6
+ metadata.gz: 33e2b5d74dcfcabfc0868652118694478e47ad5c6066e70c75090b50db7dc61008cfdfe5d4a9b438d7d7a2df91be97110d3766bfbbbd43536dfbaeacf0414c22
7
+ data.tar.gz: bd78a8be204cd636d3104d06e3ff777ade2458f0492c5e50fd6f115f7108d290d4348cf02454721ca2680ef6a872455122b50e95fa836e8f9ed7efb1a17e7e6b
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module DebugTrace
5
- VERSION = '0.2.1'
5
+ VERSION = '0.2.2'
6
6
  end
data/lib/debugtrace.rb CHANGED
@@ -64,12 +64,10 @@ module DebugTrace
64
64
  end
65
65
 
66
66
  class PrintOptions
67
- attr_reader :reflection,
68
- :minimum_output_count, :minimum_output_length,
67
+ attr_reader :minimum_output_count, :minimum_output_length,
69
68
  :collection_limit, :bytes_limit, :string_limit, :reflection_limit
70
69
 
71
70
  def initialize(
72
- reflection,
73
71
  minimum_output_count,
74
72
  minimum_output_length,
75
73
  collection_limit,
@@ -77,7 +75,6 @@ module DebugTrace
77
75
  string_limit,
78
76
  reflection_limit
79
77
  )
80
- @reflection = reflection
81
78
  @minimum_output_count = minimum_output_count == -1 ? DebugTrace.config.minimum_output_count : minimum_output_count
82
79
  @minimum_output_length = minimum_output_length == -1 ? DebugTrace.config.minimum_output_length : minimum_output_length
83
80
  @collection_limit = collection_limit == -1 ? DebugTrace.config.collection_limit : collection_limit
@@ -133,27 +130,20 @@ module DebugTrace
133
130
  value_buff = to_string_enumerable(value, print_options)
134
131
  buff.append_buffer(separator, value_buff)
135
132
  else
133
+ # use reflection
136
134
  value_buff = LogBuffer.new(@@config.maximum_data_output_width)
137
- if !print_options.reflection && has_to_s_method?(value)
138
- # has to_s or inspect method
139
- value_buff.append('to_s: ')
140
- value_buff.no_break_append(value.to_s)
141
- buff.append_buffer(separator, value_buff)
135
+ if @@reflected_objects.any? { |obj| value.equal?(obj) }
136
+ # cyclic reference
137
+ value_buff.no_break_append(@@config.cyclic_reference_string)
138
+ elsif @@reflected_objects.length > print_options.reflection_limit
139
+ # over reflection level limitation
140
+ value_buff.no_break_append(@@config.limit_string)
142
141
  else
143
- # use reflection
144
- if @@reflected_objects.any? { |obj| value.equal?(obj) }
145
- # cyclic reference
146
- value_buff.no_break_append(@@config.cyclic_reference_string)
147
- elsif @@reflected_objects.length > print_options.reflection_limit
148
- # over reflection level limitation
149
- value_buff.no_break_append(@@config.limit_string)
150
- else
151
- @@reflected_objects.push(value)
152
- value_buff = to_string_reflection(value, print_options)
153
- @@reflected_objects.pop
154
- end
155
- buff.append_buffer(separator, value_buff)
142
+ @@reflected_objects.push(value)
143
+ value_buff = to_string_reflection(value, print_options)
144
+ @@reflected_objects.pop
156
145
  end
146
+ buff.append_buffer(separator, value_buff)
157
147
  end
158
148
 
159
149
  buff
@@ -462,7 +452,7 @@ module DebugTrace
462
452
 
463
453
  @@DO_NOT_OUTPUT = 'Do not output'
464
454
 
465
- def self.print(name, value = @@DO_NOT_OUTPUT, reflection: false,
455
+ def self.print(name, value = @@DO_NOT_OUTPUT,
466
456
  minimum_output_count: -1, minimum_output_length: -1,
467
457
  collection_limit: -1, bytes_limit: -1,
468
458
  string_limit: -1, reflection_limit: -1)
@@ -482,7 +472,6 @@ module DebugTrace
482
472
  else
483
473
  # with value
484
474
  print_options = PrintOptions.new(
485
- reflection,
486
475
  minimum_output_count, minimum_output_length,
487
476
  collection_limit, bytes_limit,
488
477
  string_limit, reflection_limit
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: debugtrace
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masato Kokubo