diff options
Diffstat (limited to 'lib/chef/resource_collection.rb')
-rw-r--r-- | lib/chef/resource_collection.rb | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/chef/resource_collection.rb b/lib/chef/resource_collection.rb index baf959c33b..5ab7fc608c 100644 --- a/lib/chef/resource_collection.rb +++ b/lib/chef/resource_collection.rb @@ -52,8 +52,12 @@ class Chef @resources << a @resources_by_name[a.to_s] = @resources.length - 1 end + self end + # 'push' is an alias method to << + alias_method :push, :<< + def insert(resource) is_chef_resource(resource) if @insert_after_idx @@ -73,14 +77,6 @@ class Chef end end - def push(*args) - args.flatten.each do |arg| - is_chef_resource(arg) - @resources.push(arg) - @resources_by_name[arg.to_s] = @resources.length - 1 - end - end - def each @resources.each do |resource| yield resource @@ -206,7 +202,7 @@ class Chef resource_name = "#{resource_type}[#{name}]" results << lookup(resource_name) else - raise ArgumentError, "You must have a string like resource_type[name]!" + raise ArgumentError, "Bad string format #{arg}, you must have a string like resource_type[name]!" end return results end |