module Yarnlock::Entry::Collection
Public Class Methods
parse(raw_entries)
click to toggle source
# File lib/yarnlock/entry/collection.rb, line 6 def self.parse(raw_entries) raw_entries.map do |pattern, raw_entry| Entry.parse pattern, raw_entry end.extend(self) end
Public Instance Methods
as_json(_options = {})
click to toggle source
# File lib/yarnlock/entry/collection.rb, line 25 def as_json(_options = {}) each_with_object({}) do |entry, entries| entries.merge! entry.to_h end end
highest_version_packages()
click to toggle source
# File lib/yarnlock/entry/collection.rb, line 19 def highest_version_packages each_with_object({}) do |entry, packages| packages[entry.package] = [entry, packages[entry.package]].compact.max_by(&:version) end end
package_with_versions()
click to toggle source
# File lib/yarnlock/entry/collection.rb, line 12 def package_with_versions each_with_object({}) do |entry, packages| packages[entry.package] ||= {} packages[entry.package][entry.version] = entry end end
to_json(*options)
click to toggle source
# File lib/yarnlock/entry/collection.rb, line 31 def to_json(*options) as_json(*options).to_json(*options) end