Class: Lapis::Minecraft::Versioning::Library

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

Overview

Dependency needed to run Minecraft.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, resources, rules = [], exclude_paths = []) ⇒ Library

Creates information about a dependency.

Parameters:

  • name (String)

    Name of the dependency.

  • resources (ResourceSet)

    Set of resources included in the library.

  • rules (Array<Rule>) (defaults to: [])

    Filter for which files should be installed.

  • exclude_paths (Array<String>) (defaults to: [])

    Paths to ignore when extracting resources.



29
30
31
32
33
34
# File 'lib/lapis/minecraft/versioning/library.rb', line 29

def initialize(name, resources, rules = [], exclude_paths = [])
  @name          = name.dup.freeze
  @resources     = resources
  @rules         = rules.dup.freeze
  @exclude_paths = exclude_paths.map(&:freeze).freeze
end

Instance Attribute Details

#exclude_pathsArray<String> (readonly)

Paths to ignore when extracting resources.

Returns:

  • (Array<String>)


22
23
24
# File 'lib/lapis/minecraft/versioning/library.rb', line 22

def exclude_paths
  @exclude_paths
end

#nameString (readonly)

Name of the dependency.

Returns:

  • (String)


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

def name
  @name
end

#resourcesResourceSet (readonly)

Set of resources included in the library.

Returns:



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

def resources
  @resources
end

#rulesArray<Rule> (readonly)

Filter for which files should be installed.

Returns:



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

def rules
  @rules
end

Instance Method Details

#==(other) ⇒ true, false

Compares one library to another.

Parameters:

  • other (Library)

    Library to compare against.

Returns:

  • (true)

    The libraries are the same.

  • (false)

    The libraries are different.



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

def ==(other)
  other.name == @name &&
      other.resources == @resources &&
      other.rules == @rules &&
      other.exclude_paths == @exclude_paths
end