Sha256: 7fb2d298157509cc0d5f030147351b6ed4bc0e106a01695ad9238978b4749ee0
Contents?: true
Size: 712 Bytes
Versions: 1
Compression:
Stored size: 712 Bytes
Contents
# frozen_string_literal: true require 'json' module Cosensee module Node # for codeblock Codeblock = Data.define(:content, :name, :raw) do alias_method :to_s, :raw # @param [String] text # @param [String] raw_line # @return [Codeblock] def append_text(text:, raw_line:) new_content = if content && !content.empty? "#{content}\n#{text}" else text end Codeblock.new(content: new_content, name:, raw: "#{raw}\n#{raw_line}") end def to_obj "code:#{content}" end def to_json(*) to_obj.to_json(*) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cosensee-0.8.0 | lib/cosensee/node/codeblock.rb |