Class: Lapis::Yggdrasil::Agent
- Inherits:
-
Object
- Object
- Lapis::Yggdrasil::Agent
- Defined in:
- lib/lapis/yggdrasil/agent.rb
Overview
Information about the game to associate profiles with.
Constant Summary collapse
- DEFAULT_AGENT =
Agent used for Minecraft.
new('Minecraft', 1)
Instance Attribute Summary collapse
-
#name ⇒ String
readonly
Name of the game.
-
#version ⇒ Fixnum
readonly
Client profile version.
Class Method Summary collapse
-
.from_properties(properties) ⇒ Agent
Creates an agent from a set of properties in a request.
Instance Method Summary collapse
-
#==(other) ⇒ true, false
Compares the agent to another.
-
#initialize(name, version) ⇒ Agent
constructor
Creates an agent.
Constructor Details
#initialize(name, version) ⇒ Agent
Creates an agent.
19 20 21 22 |
# File 'lib/lapis/yggdrasil/agent.rb', line 19 def initialize(name, version) @name = name.dup.freeze @version = version end |
Instance Attribute Details
#name ⇒ String (readonly)
Name of the game.
9 10 11 |
# File 'lib/lapis/yggdrasil/agent.rb', line 9 def name @name end |
#version ⇒ Fixnum (readonly)
Note:
This is always 1 right now, but may be increased in the future.
Client profile version.
14 15 16 |
# File 'lib/lapis/yggdrasil/agent.rb', line 14 def version @version end |
Class Method Details
.from_properties(properties) ⇒ Agent
Note:
Missing properties will have their values pulled from DefaultAgent.
Creates an agent from a set of properties in a request.
39 40 41 42 43 |
# File 'lib/lapis/yggdrasil/agent.rb', line 39 def self.from_properties(properties) name = (properties[:name] || DEFAULT_AGENT.name).dup.freeze version = properties[:version] || DEFAULT_AGENT.version new(name, version) end |
Instance Method Details
#==(other) ⇒ true, false
Compares the agent to another.
28 29 30 31 |
# File 'lib/lapis/yggdrasil/agent.rb', line 28 def ==(other) other.name == @name && other.version == @version end |