Module: Rich::Pretty
- Defined in:
- lib/rich/json.rb
Overview
Pretty printing of Ruby objects
Class Method Summary collapse
-
.render(obj, indent: 2) ⇒ Array<Segment>
Pretty print a Ruby object.
-
.to_s(obj, color_system: ColorSystem::TRUECOLOR) ⇒ String
Render to string.
Class Method Details
.render(obj, indent: 2) ⇒ Array<Segment>
Pretty print a Ruby object
170 171 172 173 174 |
# File 'lib/rich/json.rb', line 170 def render(obj, indent: 2) segments = [] render_object(obj, 0, indent, segments) segments end |
.to_s(obj, color_system: ColorSystem::TRUECOLOR) ⇒ String
Render to string
180 181 182 |
# File 'lib/rich/json.rb', line 180 def to_s(obj, color_system: ColorSystem::TRUECOLOR) Segment.render(render(obj), color_system: color_system) end |