Sha256: aee53614bfe4df97dae93de999aca2dc8e71cdf5528b05a66d50ec74333fdecd
Contents?: true
Size: 481 Bytes
Versions: 2
Compression:
Stored size: 481 Bytes
Contents
module RenderAsMarkdown class Link # TODO: look up Github in-document link reference and implement it (e.g. "[A Header](#a-header)" ) attr_accessor :url, :text, :hint def initialize url, text=nil, hint=nil @url, @text, @hint = url.to_s, text.to_s, hint.to_s end def render text = @text.empty? ? @url : @text hint = " \"#{@hint}\"" unless @hint.empty? "[#{text}](#{@url}#{hint})" 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/link.rb |
render-as-markdown-0.0.5 | lib/render-as-markdown/link.rb |