Sha256: efeb048ef673407940f8523e788875df8d780cf16b1995c7ec8cd7b4aca98032
Contents?: true
Size: 1.14 KB
Versions: 14
Compression:
Stored size: 1.14 KB
Contents
module Vedeu module Renderers # Renders a {Vedeu::VirtualBuffer} or {Vedeu::Output} as JSON. class JSON # @param output [Array<Array<Vedeu::Char>>] # @return [String] def self.render(output) new(output).render end # @param output [Array<Array<Vedeu::Char>>] # @param path [String] # @return [String] # def self.to_file(output, path = nil) # new(output).to_file(path) # end # Returns a new instance of Vedeu::Renderers::JSON. # # @param output [Array<Array<Vedeu::Char>>] # @return [Vedeu::Renderers::JSON] def initialize(output) @output = output end # @return [String] def render return '' if output.nil? || output.empty? out = '' Array(output).each do |line| out << '' line.each do |char| out << char.to_json out << "\n" end out << "\n" end out end protected # @!attribute [r] output # @return [Array<Array<Vedeu::Char>>] attr_reader :output end # JSON end # Renderers end # Vedeu
Version data entries
14 entries across 14 versions & 1 rubygems