Class: Lapis::Minecraft::Versioning::Asset

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

Overview

Information about a content file needed for the client.

Direct Known Subclasses

Resource

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(size, sha1, path) ⇒ Asset

Creates information about an asset.


24
25
26
27
28
# File 'lib/lapis/minecraft/versioning/asset.rb', line 24

def initialize(size, sha1, path)
  @size = size
  @sha1 = sha1.dup.freeze
  @path = path ? path.dup.freeze : nil
end

Instance Attribute Details

#pathString? (readonly)

Path, relative to the installation directory, to store the asset.


18
19
20
# File 'lib/lapis/minecraft/versioning/asset.rb', line 18

def path
  @path
end

#sha1String (readonly)

SHA1 hash of the asset's contents in hexadecimal.


14
15
16
# File 'lib/lapis/minecraft/versioning/asset.rb', line 14

def sha1
  @sha1
end

#sizeFixnum (readonly)

Size of the asset in bytes.


10
11
12
# File 'lib/lapis/minecraft/versioning/asset.rb', line 10

def size
  @size
end

Instance Method Details

#==(other) ⇒ true, false

Compares one asset to another.


34
35
36
37
38
# File 'lib/lapis/minecraft/versioning/asset.rb', line 34

def ==(other)
  other.size == @size &&
      other.sha1 == @sha1 &&
      other.path == @path
end