Sha256: 229534dd52327d76f4d22a23a90b4d7bd12e5af7814069d4b155927940265023

Contents?: true

Size: 353 Bytes

Versions: 2

Compression:

Stored size: 353 Bytes

Contents

class ResourceCollection < Array
  class << self
    def build(collection)
      new(collection)
    end
  end
  
  def to_xml
    if self.size > 0
      resource_name = "#{self[0].factory_name.pluralize.dasherize}"
      "<#{resource_name} type=\"array\">" +
      self.collect{|i| i.to_xml}.join("\r\n") +
      "</#{resource_name}>"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dpickett-resource_factory-0.5.0 lib/resource_factory/resource_collection.rb
dpickett-resource_factory-0.5.1 lib/resource_factory/resource_collection.rb