Sha256: 48f3923c3afdc9f2ba7ab5006c647c6ad81d27de6ae575352617738f04142590
Contents?: true
Size: 590 Bytes
Versions: 5
Compression:
Stored size: 590 Bytes
Contents
require "json" class Hypernova::BlankRenderer def initialize(job) @job = job end def render <<-HTML <div data-hypernova-key="#{key}" data-hypernova-id="#{id}"></div> <script type="application/json" data-hypernova-key="#{key}" data-hypernova-id="#{id}"><!--#{encode}--></script> HTML end private attr_reader :job def data job[:data] end def encode JSON.generate(data).gsub(/&/, '&').gsub(/>/, '>') end def key name.gsub(/\W/, "") end def name job[:name] end def id @id ||= SecureRandom.uuid end end
Version data entries
5 entries across 5 versions & 1 rubygems