Class: Lapis::Minecraft::Versioning::Marshalling::ManifestParser

Inherits:
Object
  • Object
show all
Defined in:
lib/lapis/minecraft/versioning/marshalling/manifest_parser.rb

Overview

TODO:

JSON and structural errors are not detected and handled elegantly.

Reads a manifest document and retrieves basic version information from it.

Instance Method Summary collapse

Instance Method Details

#parse(document) ⇒ Manifest

Retrieves information about versions from a manifest document.

Parameters:

  • document (String)

    Contents of the version manifest document.

Returns:



17
18
19
20
21
22
# File 'lib/lapis/minecraft/versioning/marshalling/manifest_parser.rb', line 17

def parse(document)
  structure = JSON.parse(document)
  versions  = unmarshal_versions(structure['versions'])
  latest_release_id, latest_snapshot_id = unmarshal_latest(structure['latest'])
  Manifest.new(versions, latest_release_id, latest_snapshot_id)
end