diff options
author | Adam Jacob <adam@hjksolutions.com> | 2008-04-08 00:57:17 -0700 |
---|---|---|
committer | Adam Jacob <adam@hjksolutions.com> | 2008-04-08 00:57:17 -0700 |
commit | 95eb1375f0647accd1b1a1569a7d0e3acc4a61e4 (patch) | |
tree | a58d6fddde4d7818dc33511ff8275c7b9f69f1c6 /lib/chef/resource_collection.rb | |
parent | 434f25ba07b5c0c50baa1e15b14a945bba3c3c3b (diff) | |
download | chef-95eb1375f0647accd1b1a1569a7d0e3acc4a61e4.tar.gz |
Adding chef-solo command, config examples, Chef::Log class, Chef::Log::Formatter, Chef::Compile, and all the tests
Diffstat (limited to 'lib/chef/resource_collection.rb')
-rw-r--r-- | lib/chef/resource_collection.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/chef/resource_collection.rb b/lib/chef/resource_collection.rb index dc93cfb4fa..5728fdd3e9 100644 --- a/lib/chef/resource_collection.rb +++ b/lib/chef/resource_collection.rb @@ -33,6 +33,7 @@ class Chef def []=(index, arg) is_chef_resource(arg) + raise ArgumentError, "Already have a resource named #{arg.to_s}" if @resources_by_name.has_key?(arg.to_s) @resources[index] = arg @resources_by_name[arg.to_s] = index end @@ -40,6 +41,7 @@ class Chef def <<(*args) args.flatten.each do |a| is_chef_resource(a) + raise ArgumentError, "Already have a resource named #{a.to_s}" if @resources_by_name.has_key?(a.to_s) @resources << a @resources_by_name[a.to_s] = @resources.length - 1 end @@ -48,6 +50,7 @@ class Chef def push(*args) args.flatten.each do |a| is_chef_resource(a) + raise ArgumentError, "Already have a resource named #{a.to_s}" if @resources_by_name.has_key?(a.to_s) @resources.push(a) @resources_by_name[a.to_s] = @resources.length - 1 end |