Sha256: c3ff02c220379ad4c5092a6920d00992a43dbe0119896f6ed42ca7da659d2769
Contents?: true
Size: 1.34 KB
Versions: 6
Compression:
Stored size: 1.34 KB
Contents
# The BaseBinding class is the base for all bindings. It takes # 4 arguments that should be passed up from the children (via super) # # 1. page - this class instance should provide: # - a #templates methods that returns a hash for templates # - an #events methods that returns an instance of DocumentEvents # 2. target - an DomTarget or AttributeTarget # 3. context - the context object the binding will be evaluated in # 4. binding_name - the id for the comment (or id for attributes) where the # binding will be inserted. class BaseBinding attr_accessor :target, :context, :binding_name def initialize(page, target, context, binding_name) # puts "NEW #{context.inspect} - #{self.inspect}" @page = page @target = target @context = context @binding_name = binding_name @@binding_number ||= 10000 end def section @section ||= target.section(@binding_name) end def remove section.remove # Clear any references @target = nil @context = nil @section = nil end def remove_anchors section.remove_anchors end def queue_update if Volt.server? # Run right away update else end end def value_from_getter(getter) # Evaluate the getter proc in the context return @context.instance_eval(&getter) end end
Version data entries
6 entries across 6 versions & 1 rubygems