lib/library.rb in inqlude-0.0.8 vs lib/library.rb in inqlude-0.7.0

- old
+ new

@@ -2,9 +2,34 @@ attr_accessor :name attr_accessor :manifests def versions - versions = @manifests.map { |m| m["version"] } + versions = release_manifests.map { |m| m["version"] } end + def generic_manifest + @manifests.each do |m| + if m["schema_type"] == "generic" + return m + end + end + nil + end + + def release_manifests + result = @manifests.reject { |m| m["schema_type"] == "generic" } + result.sort! do |m1,m2| + m1["release_date"] <=> m2["release_date"] + end + result + end + + def latest_manifest + if release_manifests.empty? + return generic_manifest + else + return release_manifests.last + end + end + end