Sha256: cf7509e24f3f249e5ac0145f9b17d0ab8eb1957d826debb6764ada6a97c0e3aa

Contents?: true

Size: 363 Bytes

Versions: 2

Compression:

Stored size: 363 Bytes

Contents

module RenderAsMarkdown
  class Image

    attr_accessor :alt_text, :url, :title

    def initialize alt_text, url, title=nil
      @alt_text, @url, @title = alt_text.to_s, url.to_s, title.to_s
    end

    def render
      title = " \"#{@title}\"" unless @title.empty?
      "![#{@alt_text}](#{@url}#{title})"
    end

    alias_method :to_s, :render

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
render-as-markdown-0.0.6 lib/render-as-markdown/image.rb
render-as-markdown-0.0.5 lib/render-as-markdown/image.rb