Class: Lapis::Minecraft::Versioning::Marshalling::AssetIndexParser

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

Overview

TODO:

JSON and structural errors are not detected and handled elegantly.

Reads an asset index document and generates an AssetIndex instance.

See Also:

Instance Method Summary collapse

Instance Method Details

#parse(document) ⇒ Array<Asset>

Extract asset information from an asset index document.

Parameters:

  • document (String)

    Contents of the asset index document.

Returns:



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

def parse(document)
  structure = JSON.parse(document)
  structure['objects'].map do |path, attributes|
    unmarshal_asset(path, attributes)
  end
end