Class: Lapis::Minecraft::Versioning::AssetIndex

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

Overview

Note:

This class isn't used directly for accessing asset instances. It is used for retrieving information about assets.

Container for tracking information about assets.

See Also:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, sha1, size, url, total_size) ⇒ AssetIndex

Creates an asset index.


37
38
39
40
41
42
43
# File 'lib/lapis/minecraft/versioning/asset_index.rb', line 37

def initialize(id, sha1, size, url, total_size)
  @id         = id.dup.freeze
  @sha1       = sha1.dup.freeze
  @size       = size
  @url        = url.dup.freeze
  @total_size = total_size
end

Instance Attribute Details

#idString (readonly)

Unique name of the collection of assets.


13
14
15
# File 'lib/lapis/minecraft/versioning/asset_index.rb', line 13

def id
  @id
end

#sha1String (readonly)

SHA1 hash of the asset list document in hexadecimal.


17
18
19
# File 'lib/lapis/minecraft/versioning/asset_index.rb', line 17

def sha1
  @sha1
end

#sizeFixnum (readonly)

Size of the asset list document in bytes.


21
22
23
# File 'lib/lapis/minecraft/versioning/asset_index.rb', line 21

def size
  @size
end

#total_sizeFixnum (readonly)

Total size of all the assets combined.


29
30
31
# File 'lib/lapis/minecraft/versioning/asset_index.rb', line 29

def total_size
  @total_size
end

#urlString (readonly)

Location of where the asset list document can be found.


25
26
27
# File 'lib/lapis/minecraft/versioning/asset_index.rb', line 25

def url
  @url
end

Instance Method Details

#==(other) ⇒ true, false

Compares one asset index to another.


49
50
51
52
53
54
55
# File 'lib/lapis/minecraft/versioning/asset_index.rb', line 49

def ==(other)
  other.id == @id &&
      other.sha1 == @sha1 &&
      other.size == @size &&
      other.url == @url &&
      other.total_size == @total_size
end