Sha256: 85968bf8a3af578c939c8f3b0c861a64553da2e06167661cb8dd74c75e54006b
Contents?: true
Size: 481 Bytes
Versions: 8
Compression:
Stored size: 481 Bytes
Contents
require 'base64' module BumpsparkHelper # Generate a "bumpspark"-style sparkline image tag # # call-seq: # <%= bumpspark_tag([20, 23, 12, 23]) %> def bumpspark_tag(numbers, html_opts={}) graph = Bumpspark::Graph.new(numbers) tag(:img, html_opts.merge(:src => bumpspark_tag_src(graph))) end def bumpspark_tag_src(graph) #:nodoc: data = Base64.encode64(graph.to_png).delete("\n") return "data:image/png;base64,#{CGI.escape(data)}" end end
Version data entries
8 entries across 8 versions & 2 rubygems