diff options
-rw-r--r-- | lib/blink/type/container.rb | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/lib/blink/type/container.rb b/lib/blink/type/container.rb index 99ffdc836..7d289e45f 100644 --- a/lib/blink/type/container.rb +++ b/lib/blink/type/container.rb @@ -5,17 +5,35 @@ # the object allowing us to build complex structures # this thing contains everything else, including itself +require 'blink' +require 'blink/element' +require 'blink/transaction' require 'blink/type' module Blink - class Component < Blink::Type - @name = :component - @namevar = :name + class Container < Blink::Element + @name = :container - @parameters = [ - :name - ] + def initialize + @children = [] + end - @states = [] + # now we decide whether a transaction is dumb, and just accepts + # changes from the container, or whether it collects them itself + # for now, because i've already got this implemented, let transactions + # collect the changes themselves + def evaluate + return transaction = Blink::Transaction.new(@children) + #transaction.run + end + + def push(*ary) + ary.each { |child| + unless child.is_a?(Blink::Element) + raise "Containers can only contain Blink::Elements" + end + @children.push child + } + end end end |