Class: Lapis::Minecraft::Versioning::ResourceSet

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

Overview

Information about the archives and natives needed for a library.

See Also:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resources, windows_classifier = nil, linux_classifier = nil, osx_classifier = nil) ⇒ ResourceSet

Creates a new resource set.

Parameters:

  • resources (Array<Resource>)

    List of all resources (including natives).

  • windows_classifier (String, nil) (defaults to: nil)

    Classifier for the Windows native. Specify nil if there is no native for Windows.

  • linux_classifier (String, nil) (defaults to: nil)

    Classifier for the Linux native. Specify nil if there is no native for Linux.

  • osx_classifier (String, nil) (defaults to: nil)

    Classifier for the OSX native. Specify nil if there is no native for OSX.



39
40
41
42
43
44
# File 'lib/lapis/minecraft/versioning/resource_set.rb', line 39

def initialize(resources, windows_classifier = nil, linux_classifier = nil, osx_classifier = nil)
  @windows_classifier = windows_classifier ? windows_classifier.dup.freeze : nil
  @linux_classifier   = linux_classifier   ? linux_classifier.dup.freeze   : nil
  @osx_classifier     = osx_classifier     ? osx_classifier.dup.freeze     : nil
  @resources          = resources.dup.freeze
end

Instance Attribute Details

#linux_classifierString? (readonly)

Note:

This value can contain variables.

Classifier for the Linux native.

Returns:

  • (String)

    Classifier for Linux.

  • (nil)

    No Linux native for this library.



19
20
21
# File 'lib/lapis/minecraft/versioning/resource_set.rb', line 19

def linux_classifier
  @linux_classifier
end

#osx_classifierString? (readonly)

Note:

This value can contain variables.

Classifier for the OSX native.

Returns:

  • (String)

    Classifier for OSX.

  • (nil)

    No OSX native for this library.



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

def osx_classifier
  @osx_classifier
end

#resourcesArray<Resource> (readonly)

List of all resources (including natives) the library uses.

Returns:



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

def resources
  @resources
end

#windows_classifierString? (readonly)

Note:

This value can contain variables.

Classifier for the Windows native.

Returns:

  • (String)

    Classifier for Windows.

  • (nil)

    No Windows native for this library.



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

def windows_classifier
  @windows_classifier
end

Instance Method Details

#==(other) ⇒ true, false

Compares one resource set to another.

Parameters:

  • other (ResourceSet)

    Resource set to compare against.

Returns:

  • (true)

    The resource sets are the same.

  • (false)

    The resource sets are different.



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

def ==(other)
  other.windows_classifier == @windows_classifier &&
      other.linux_classifier == @linux_classifier &&
      other.osx_classifier == @osx_classifier &&
      other.resources == @resources
end