diff options
Diffstat (limited to 'lib/blink/component.rb')
-rw-r--r-- | lib/blink/component.rb | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/lib/blink/component.rb b/lib/blink/component.rb index 35a8d83d9..62481f000 100644 --- a/lib/blink/component.rb +++ b/lib/blink/component.rb @@ -11,7 +11,17 @@ module Blink class Component < Blink::Type attr_accessor :name - @objects = Hash.new(nil) + @name = :component + @namevar = :name + @params = [ + :name + ] + + #--------------------------------------------------------------- + def [](object) + @subobjects[object] + end + #--------------------------------------------------------------- #--------------------------------------------------------------- # our components are effectively arrays, with a bit extra functionality @@ -23,16 +33,19 @@ module Blink #--------------------------------------------------------------- #--------------------------------------------------------------- - def initialize(*args) - args = Hash[*args] + def initialize(hash) + #super(hash) + begin + @name = hash[:name] + rescue + fail TypeError.new("Components must be provided a name") + end - unless args.include?(:name) + unless @name fail TypeError.new("Components must be provided a name") - else - self.name = args[:name] end - Component[self.name] = self + self.class[self.name] = self @subobjects = [] end @@ -47,9 +60,9 @@ module Blink #--------------------------------------------------------------- #--------------------------------------------------------------- - def to_s - return self.name - end + #def to_s + # return self.name + #end #--------------------------------------------------------------- end end |