Class: Lapis::Minecraft::Versioning::Basic

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

Overview

Minimal information about a Minecraft version.

Direct Known Subclasses

Lapis::Minecraft::Version, Detailed

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, type, time, url) ⇒ Basic

Creates the basic information for a Minecraft version.


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

def initialize(id, type, time, url)
  @id   = id.dup.freeze
  @type = type
  @time = time
  @url  = url.dup.freeze
end

Instance Attribute Details

#idString (readonly)

Unique identifier used to reference the version.


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

def id
  @id
end

#timeTime (readonly)

Date and time the version was made available to the public.


23
24
25
# File 'lib/lapis/minecraft/versioning/basic.rb', line 23

def time
  @time
end

#typeSymbol (readonly)

Type of version. This can be one of:

  • :release - Official release.

  • :snapshot - Unstable, in development.

  • :beta - Old beta.

  • :alpha - Old alpha.


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

def type
  @type
end

#urlString (readonly)

URL pointing to detailed information about the version.


27
28
29
# File 'lib/lapis/minecraft/versioning/basic.rb', line 27

def url
  @url
end

Instance Method Details

#==(other) ⇒ true, false

Compares one version to another.


45
46
47
48
49
50
# File 'lib/lapis/minecraft/versioning/basic.rb', line 45

def ==(other)
  other.id == @id &&
      other.type == @type &&
      other.time == @time &&
      other.url == @url
end