Class: Shellfie::TranscriptRenderer
- Inherits:
-
Object
- Object
- Shellfie::TranscriptRenderer
- Defined in:
- lib/shellfie/transcript_renderer.rb
Instance Method Summary collapse
-
#initialize(config) ⇒ TranscriptRenderer
constructor
A new instance of TranscriptRenderer.
- #render(output_path, format:, io: nil) ⇒ Object
Constructor Details
#initialize(config) ⇒ TranscriptRenderer
Returns a new instance of TranscriptRenderer.
10 11 12 |
# File 'lib/shellfie/transcript_renderer.rb', line 10 def initialize(config) @config = config end |
Instance Method Details
#render(output_path, format:, io: nil) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/shellfie/transcript_renderer.rb', line 14 def render(output_path, format:, io: nil) OutputWriter.write(output_path, extension: format, io: io) do |temporary_path| value = case format when "json" then JSON.pretty_generate(document) when "ansi" then ansi_text when "asciicast", "cast" then asciicast else text end File.write(temporary_path, value) end end |