Sha256: 7737f089d9ccdf13926fe702f23282b6301605fe376175a1befb2b804dc2a42f
Contents?: true
Size: 914 Bytes
Versions: 6
Compression:
Stored size: 914 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 # puts "UPDATE C: #{value.inspect} on #{self.inspect}" # 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