Sha256: 00f4a1388e46ddf80c624f313a22e35898795cca70fcf8b0b08c5bcb148ef31d
Contents?: true
Size: 850 Bytes
Versions: 22
Compression:
Stored size: 850 Bytes
Contents
require 'volt/page/bindings/base_binding' class ContentBinding < BaseBinding def initialize(target, context, binding_name, getter) # puts "new content binding: #{getter}" super(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
22 entries across 22 versions & 1 rubygems