Sha256: 105ee054d77f5e9d4d92abf72cdbaad3f77f0569f6c6a4c95431d43901e9a4c0
Contents?: true
Size: 723 Bytes
Versions: 3
Compression:
Stored size: 723 Bytes
Contents
module Lissio; class Component class Container < Component class Definer def initialize(&block) @list = [] if block.arity == 0 instance_exec(&block) else block.call(self) end end def render(what) @list << what end def to_a @list end end def initialize(parent, &block) super(parent) if block @content = Definer.new(&block).to_a else @content = [] end end def render(*content, &block) content = @content.dup if content.empty? content.compact! # FIXME: when it's fixed element.clear content.each {|c| if String === c element << c else element << c.render end } if block element << DOM(&block) end super end end end; end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
lissio-0.1.0.beta3 | opal/lissio/component/container.rb |
lissio-0.1.0.beta2 | opal/lissio/component/container.rb |
lissio-0.1.0.beta1 | opal/lissio/component/container.rb |