Module: Dolt::View::BinaryBlobEmbedder
- Defined in:
- lib/libdolt/view/binary_blob_embedder.rb
Instance Method Summary collapse
Instance Method Details
#format_binary_blob(path, content, repository, ref) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/libdolt/view/binary_blob_embedder.rb', line 27 def format_binary_blob(path, content, repository, ref) if !image?(path, content) return link_binary_blob(path, content, repository, ref) end url = raw_url(repository, ref, path) <<-HTML <p class="prettyprint"> <a href="#{url}"><img src="#{url}" alt="#{path}"></a> </p> HTML end |
#image?(path, content) ⇒ Boolean
23 24 25 |
# File 'lib/libdolt/view/binary_blob_embedder.rb', line 23 def image?(path, content) MIME::Types.type_for(path).any? { |mt| mt.media_type == "image" } end |