class Steam::Id::Steam3IdParser

Parse a steam 3 id string

Constants

STEAM3_REGEX

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

Attributes

account_id[R]
type[R]
universe[R]

Public Class Methods

new(id) click to toggle source
# File lib/steam/id/steam3_id_parser.rb, line 13
def initialize(id)
  @id = id.to_s
  @type = nil
  @account_id = 0
  @universe = EUniverse::INVALID
  @type = 'U'
end

Public Instance Methods

instance() click to toggle source

The instance of the account. Currently only instance 1 is supported

# File lib/steam/id/steam3_id_parser.rb, line 31
def instance
  1
end
parse() click to toggle source

Create a Steam3 id by parsing an input string

# File lib/steam/id/steam3_id_parser.rb, line 22
def parse
  return unless matches

  @account_id = Integer(matches['account'])
  @universe = Integer(matches['universe'])
  @type = matches['type']
end

Private Instance Methods

matches() click to toggle source

@api private

# File lib/steam/id/steam3_id_parser.rb, line 48
def matches
  @matches ||= @id.match(STEAM3_REGEX)
end