Array
# File lib/fog/core/collection.rb, line 43 def clear @loaded = true super end
# File lib/fog/core/collection.rb, line 48 def create(attributes = {}) object = new(attributes) object.save object end
# File lib/fog/core/collection.rb, line 54 def destroy(identity) object = new(:identity => identity) object.destroy end
# File lib/fog/core/collection.rb, line 65 def inspect Thread.current[:formatador] ||= Formatador.new data = "#{Thread.current[:formatador].indentation}<#{self.class.name}\n" Thread.current[:formatador].indent do unless self.class.attributes.empty? data << "#{Thread.current[:formatador].indentation}" data << self.class.attributes.map {|attribute| "#{attribute}=#{send(attribute).inspect}"}.join(",\n#{Thread.current[:formatador].indentation}") data << "\n" end data << "#{Thread.current[:formatador].indentation}[" unless self.empty? data << "\n" Thread.current[:formatador].indent do data << self.map {|member| member.inspect}.join(",\n") data << "\n" end data << Thread.current[:formatador].indentation end data << "]\n" end data << "#{Thread.current[:formatador].indentation}>" data end
# File lib/fog/core/collection.rb, line 89 def load(objects) clear for object in objects self << new(object) end self end
# File lib/fog/core/collection.rb, line 97 def model self.class.instance_variable_get('@model') end
# File lib/fog/core/collection.rb, line 101 def new(attributes = {}) unless attributes.is_a?(Hash) raise(ArgumentError.new("Initialization parameters must be an attributes hash, got #{attributes.inspect}")) end model.new( attributes.merge( :collection => self, :connection => connection ) ) end
# File lib/fog/core/collection.rb, line 113 def reload clear lazy_load self end
Generated with the Darkfish Rdoc Generator 2.