Class: Agent::SessionContext::Renderers::Text

Inherits:
Object
  • Object
show all
Defined in:
lib/agent/session_context/renderers/text.rb

Instance Method Summary collapse

Instance Method Details

#call(value) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/agent/session_context/renderers/text.rb', line 21

def call(value)
  # LoopView already renders sizes and tool names only, never bodies —
  # printing it here instead of routing the Loop through Serializer is
  # what keeps that guarantee: Serializer walks a Data object's members
  # generically, and Loop's round trips carry the raw on-disk record.
  return LoopView.new(value).ascii.chomp if value.is_a?(Loop)

  if value.is_a?(Snapshot)
    render_snapshot(value)
  else
    render_prompts(Array(value))
  end
end