Class: Lapis::Minecraft::Versioning::Manifest
- Inherits:
-
Object
- Object
- Lapis::Minecraft::Versioning::Manifest
- Includes:
- Enumerable
- Defined in:
- lib/lapis/minecraft/versioning/manifest.rb
Overview
Contains basic information about all known versions of Minecraft.
Instance Attribute Summary collapse
-
#latest_release ⇒ Basic
readonly
Retrieves information about the latest release.
-
#latest_snapshot ⇒ Basic
readonly
Retrieves information about the latest snapshot.
Instance Method Summary collapse
-
#==(other) ⇒ true, false
Compares one manifest to another.
-
#[](id) ⇒ Basic?
Retrieves version information given a specific ID.
-
#each {|version| ... } ⇒ Enumerator<Basic>
Iterates over all versions.
-
#initialize(versions, latest_release_id, latest_snapshot_id) ⇒ Manifest
constructor
Creates a new manifest with version instances.
Constructor Details
#initialize(versions, latest_release_id, latest_snapshot_id) ⇒ Manifest
Creates a new manifest with version instances.
21 22 23 24 25 |
# File 'lib/lapis/minecraft/versioning/manifest.rb', line 21 def initialize(versions, latest_release_id, latest_snapshot_id) @versions = versions.dup.freeze @latest_release = versions.find { |version| version.id == latest_release_id } @latest_snapshot = versions.find { |version| version.id == latest_snapshot_id } end |
Instance Attribute Details
#latest_release ⇒ Basic (readonly)
Retrieves information about the latest release.
11 12 13 |
# File 'lib/lapis/minecraft/versioning/manifest.rb', line 11 def latest_release @latest_release end |
#latest_snapshot ⇒ Basic (readonly)
Retrieves information about the latest snapshot.
15 16 17 |
# File 'lib/lapis/minecraft/versioning/manifest.rb', line 15 def latest_snapshot @latest_snapshot end |
Instance Method Details
#==(other) ⇒ true, false
Compares one manifest to another.
50 51 52 53 54 |
# File 'lib/lapis/minecraft/versioning/manifest.rb', line 50 def ==(other) other.entries == @versions && other.latest_release == @latest_release && other.latest_snapshot == @latest_snapshot end |
#[](id) ⇒ Basic?
Retrieves version information given a specific ID.
42 43 44 |
# File 'lib/lapis/minecraft/versioning/manifest.rb', line 42 def [](id) @versions.find { |version| version.id == id } end |
#each {|version| ... } ⇒ Enumerator<Basic>
Iterates over all versions.
30 31 32 33 34 35 36 |
# File 'lib/lapis/minecraft/versioning/manifest.rb', line 30 def each return enum_for(:each) unless block_given? @versions.each do |version| yield version end end |