summaryrefslogtreecommitdiffstats
path: root/lib/blink/component.rb
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2005-04-18 23:47:19 +0000
committerLuke Kanies <luke@madstop.com>2005-04-18 23:47:19 +0000
commit43a63db736ebb4a014250d36c8f6866f2aacced7 (patch)
tree8847c7792083abf45d367ecf72e0c1ad12dfe5d3 /lib/blink/component.rb
parenta16493db1308e3d6b9b2c4e60ed5b9e5eda7d048 (diff)
downloadpuppet-43a63db736ebb4a014250d36c8f6866f2aacced7.tar.gz
puppet-43a63db736ebb4a014250d36c8f6866f2aacced7.tar.xz
puppet-43a63db736ebb4a014250d36c8f6866f2aacced7.zip
fixing filetype and component to take into account changes type interface.rb and type.rb
git-svn-id: https://reductivelabs.com/svn/puppet/library/trunk@189 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/blink/component.rb')
-rw-r--r--lib/blink/component.rb33
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