Class: Julewire::Core::Diagnostics::Tail::Renderer

Inherits:
Object
  • Object
show all
Defined in:
lib/julewire/core/diagnostics/tail/renderer.rb

Constant Summary collapse

DEFAULT_MAX_VALUE_BYTES =
Serialization::TextEncoder::DEFAULT_MAX_VALUE_BYTES

Instance Method Summary collapse

Constructor Details

#initialize(max_value_bytes: DEFAULT_MAX_VALUE_BYTES) ⇒ Renderer

Returns a new instance of Renderer.



10
11
12
13
14
15
16
# File 'lib/julewire/core/diagnostics/tail/renderer.rb', line 10

def initialize(max_value_bytes: DEFAULT_MAX_VALUE_BYTES)
  @max_value_bytes = Validation.validate_integer_limit!(
    max_value_bytes,
    name: :max_value_bytes,
    positive: true
  )
end

Instance Method Details

#call(entries, color: false) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/julewire/core/diagnostics/tail/renderer.rb', line 18

def call(entries, color: false)
  encoder = Serialization::TextEncoder.new(
    color: color,
    max_value_bytes: @max_value_bytes
  )
  entries.map { encoder.call(payload_for(it)) }.join
end