class Steam::Id::Steam2Id

Represents a Steam ID in the Steam2 format.

Public Class Methods

new(universe, account_id, auth_server) click to toggle source

Instantiate a Steam2Id object

Calls superclass method Steam::Id::Base::new
# File lib/steam/id/steam2_id.rb, line 18
def initialize(universe, account_id, auth_server)
  super()
  self.instance = 1
  self.universe = universe
  self.account_type = EAccountType::INDIVIDUAL
  self.account_id = (account_id << 1) | auth_server
end
parse(id) click to toggle source

Parse a Steam2Id from a given input string

@param id [String] the input string @return [Steam2Id, nil]

# File lib/steam/id/steam2_id.rb, line 10
def self.parse(id)
  parser = Steam2IdParser.new(id)
  parser.parse

  new(parser.universe, parser.account_id, parser.auth_server)
end

Public Instance Methods

universe=(universe) click to toggle source

Sets the correct universe for a Steam2Id

@param universe [Integer] the universe

# File lib/steam/id/steam2_id.rb, line 29
def universe=(universe)
  struct.universe = universe.zero? ? EUniverse::PUBLIC : universe
end