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.

Parameters:

  • id (String)

    Unique identifier used to reference the version.

  • type (Symbol)

    :release, :snapshot, :beta, or :alpha.

  • time (Time)

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

  • url (String)

    URL pointing to detailed information about the 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.

Returns:

  • (String)

    Unique identifier.



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.

Returns:

  • (Time)


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.

Returns:

  • (Symbol)

    :release, :snapshot, :beta, or :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.

Returns:

  • (String)

    Version URL.



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.

Parameters:

  • other (Basic)

    Version to compare against.

Returns:

  • (true)

    The versions are the same.

  • (false)

    The versions are different.



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