Sha256: 05ccd6badfd4ed3412e4d5961ef06f58bfc4043006e7c0ab6b4af09fc9c41d36
Contents?: true
Size: 927 Bytes
Versions: 14
Compression:
Stored size: 927 Bytes
Contents
module Trestle class Toolbar # The toolbar Context is the object that is yielded to a toolbar block and handles the delegation of builder methods. class Context attr_reader :builder def initialize(builder, enumerator, *args) @builder, @enumerator = builder, enumerator @args = args end def group if @current_group yield else @current_group = [] yield @enumerator << @current_group @current_group = nil end end private def respond_to_missing?(name, include_all=false) builder.respond_to?(name) || super end def method_missing(name, *args, &block) result = builder.send(name, *args, &block) if builder.builder_methods.include?(name) group { @current_group << result } else result end end end end end
Version data entries
14 entries across 14 versions & 1 rubygems