lib/gnawrnip/publisher.rb in gnawrnip-0.1.3 vs lib/gnawrnip/publisher.rb in gnawrnip-0.2.0

- old
+ new

@@ -1,21 +1,30 @@ require 'base64' module Gnawrnip - module Publisher + class Publisher + + # + # @params [Array] paths Array of screenshot image filename + # def animation(paths) - raise NotImplementedError + paths.map { |path| image_tag(path) }.join end + # + # @params [string] path Screenshot image filename + # def single(path) - image_tag(image_base64(path)) + image_tag(path) end - def image_base64(path) - Base64.strict_encode64(File.read(path)) - end + private - def image_tag(data, format = :png) - '<img src="data:image/' + format.to_s + ';base64,' + data + '"/>' - end + def image_tag(path, format = :png) + %Q|<img src="data:image/#{format.to_s};base64,#{image_base64(path)}"/>| + end + + def image_base64(path) + Base64.strict_encode64(File.read(path)) + end end end