class Steam::Id::Struct

The internal datastructure of a steamid. A 64 bit integer

Constants

ACCOUNT_ID_MASK

The bit mask applied to get the account id

ACCOUNT_TYPE_MASK

The bit mask applied to get the account type

INSTANCE_MASK

The bit mask applied to get the instance mask

UNIVERSE_MASK

The bit mask applied to get the universe mask

Attributes

data[R]

Public Class Methods

new(data = 0) click to toggle source
# File lib/steam/id/struct.rb, line 19
def initialize(data = 0)
  @data = data.to_i
end

Public Instance Methods

account_id() click to toggle source

Gets the account id

@return [Integer] the account id

# File lib/steam/id/struct.rb, line 31
def account_id
  get(0, ACCOUNT_ID_MASK)
end
account_id=(value) click to toggle source

Sets the account_id

@return [Integer] the account id

# File lib/steam/id/struct.rb, line 38
def account_id=(value)
  set(0, ACCOUNT_ID_MASK, value)
end
account_type() click to toggle source

Gets the account type

@return [Integer] the account type

# File lib/steam/id/struct.rb, line 57
def account_type
  get(52, ACCOUNT_TYPE_MASK)
end
account_type=(value) click to toggle source

Sets the account type

# File lib/steam/id/struct.rb, line 62
def account_type=(value)
  set(52, ACCOUNT_TYPE_MASK, value)
end
instance() click to toggle source

Gets the instance

@return [Integer] the account id

# File lib/steam/id/struct.rb, line 45
def instance
  get(32, INSTANCE_MASK)
end
instance=(value) click to toggle source

Sets the instance

# File lib/steam/id/struct.rb, line 50
def instance=(value)
  set(32, INSTANCE_MASK, value)
end
to_i() click to toggle source

Returns the internal integer

# File lib/steam/id/struct.rb, line 24
def to_i
  @data.to_i
end
universe() click to toggle source

Gets the universe

@return [Integer] the universe

# File lib/steam/id/struct.rb, line 69
def universe
  get(56, UNIVERSE_MASK)
end
universe=(value) click to toggle source

Sets the universe

# File lib/steam/id/struct.rb, line 74
def universe=(value)
  set(56, UNIVERSE_MASK, value)
end

Private Instance Methods

get(offset, mask) click to toggle source

@api private

# File lib/steam/id/struct.rb, line 81
def get(offset, mask)
  (@data >> offset) & mask
end
set(offset, mask, value) click to toggle source

@api private

# File lib/steam/id/struct.rb, line 86
def set(offset, mask, value)
  @data = (@data & ~(mask << offset)) | ((value & mask) << offset)
end