Sha256: ab28eb8258f0df5ffaf50e0de9e957dfd51c66473a25ff6917aa5fc26cf3b0d5

Contents?: true

Size: 388 Bytes

Versions: 1

Compression:

Stored size: 388 Bytes

Contents

# frozen_string_literal: true

module Cosensee
  module Node
    # for double Bracket
    DoubleBracket = Data.define(:content, :raw) do
      def image?
        content.size == 1 && content[0].match?(/\.(png|jpg)$/)
      end

      alias_method :to_s, :raw

      def to_obj
        "[[#{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/double_bracket.rb