Sha256: a40ad139228cf14c88adb234c171a1601e32415c1596e8e88f21d087df12731b
Contents?: true
Size: 862 Bytes
Versions: 6
Compression:
Stored size: 862 Bytes
Contents
require 'volt/page/bindings/base_binding' class ContentBinding < BaseBinding def initialize(page, target, context, binding_name, getter) # puts "new content binding: #{getter}" super(page, target, context, binding_name) # Find the source for the content binding @value = value_from_getter(getter) # Run the initial render update if @value.reactive? @changed_listener = @value.on('changed') { update } end end def update value = @value.cur.or('') # Exception values display the exception as a string value = value.to_s # Update the html in this section # TODO: Move the formatter into another class. section.html = value.gsub("\n", "<br />\n") end def remove if @changed_listener @changed_listener.remove @changed_listener = nil end super end end
Version data entries
6 entries across 6 versions & 1 rubygems