Class: Lapis::Minecraft::Versioning::Marshalling::VersionParser

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

Overview

TODO:

JSON and structural errors are not detected and handled elegantly.

Reads a version document and generates a Detailed instance.

See Also:

Instance Method Summary collapse

Instance Method Details

#parse(document, url) ⇒ Detailed

Retrieves detailed information from a version document.

Parameters:

  • document (String)

    Contents of the version document.

  • url (String)

    Location of the version document.

Returns:



26
27
28
29
30
31
32
33
34
# File 'lib/lapis/minecraft/versioning/marshalling/version_parser.rb', line 26

def parse(document, url)
  structure = JSON.parse(document)
  basic               = unmarshal_basic_info(structure, url)
  asset_index         = unmarshal_asset_index(structure['assetIndex'])
  downloads           = unmarshal_downloads(structure['downloads'])
  libraries           = unmarshal_libraries(structure['libraries'])
  launcher_properties = unmarshal_launcher_properties(structure)
  Detailed.new(basic, asset_index, downloads, libraries, launcher_properties)
end