Class: Lapis::Minecraft::Versioning::Resource

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

Overview

Information about a resource (file) to download as part of the client or server.

Instance Attribute Summary collapse

Attributes inherited from Asset

#path, #sha1, #size

Instance Method Summary collapse

Constructor Details

#initialize(url, size, sha1, path = nil, classifier = nil) ⇒ Resource

Creates information about a resource.


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

def initialize(url, size, sha1, path = nil, classifier = nil)
  super(size, sha1, path)
  @url        = url.dup.freeze
  @classifier = classifier.dup.freeze
end

Instance Attribute Details

#classifierString? (readonly)

Logical category the resource falls under.


16
17
18
# File 'lib/lapis/minecraft/versioning/resource.rb', line 16

def classifier
  @classifier
end

#urlString (readonly)

URL where the resource can be found and downloaded from.


12
13
14
# File 'lib/lapis/minecraft/versioning/resource.rb', line 12

def url
  @url
end

Instance Method Details

#==(other) ⇒ true, false

Compares one resource to another.


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

def ==(other)
  super(other) &&
      other.url == @url &&
      other.classifier == @classifier
end