Sha256: a7abcf9da42770e0e26153599879187e4449607bdb4e067fa1e5416845ea7c63

Contents?: true

Size: 342 Bytes

Versions: 1

Compression:

Stored size: 342 Bytes

Contents

# frozen_string_literal: true

module Cosensee
  # 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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cosensee-0.6.0 lib/cosensee/double_bracket.rb