class Steam::Id::Steam2IdParser

Parse a steam 2 id string

Constants

STEAM2_REGEX

A Regex representing a valid Steam 2 string rubocop:disable LineLength

Attributes

account_id[R]
auth_server[R]
universe[R]

Public Class Methods

new(id) click to toggle source
# File lib/steam/id/steam2_id_parser.rb, line 11
def initialize(id)
  @id = id.to_s
  @universe = EUniverse::INVALID
  @account_id = 0
  @auth_server = 0
end

Public Instance Methods

parse() click to toggle source

Parse a Steam2Id from a given input string

# File lib/steam/id/steam2_id_parser.rb, line 19
def parse
  return unless matches
  @universe   = Integer(matches['universe'])
  @account_id = Integer(matches['accountid'])
  @auth_server = Integer(matches['authserver'])
end

Private Instance Methods

matches() click to toggle source

@api private

# File lib/steam/id/steam2_id_parser.rb, line 29
def matches
  @matches ||= @id.match(STEAM2_REGEX)
end