Class: Steam::Id::Struct

Inherits:
Object
  • Object
show all
Defined in:
lib/steam/id/struct.rb

Overview

The internal datastructure of a steamid. A 64 bit integer

Constant Summary collapse

ACCOUNT_ID_MASK =

The bit mask applied to get the account id

0xFFFFFFFF
INSTANCE_MASK =

The bit mask applied to get the instance mask

0xFFFFF
UNIVERSE_MASK =

The bit mask applied to get the universe mask

0xFF
ACCOUNT_TYPE_MASK =

The bit mask applied to get the account type

0xF

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data = 0) ⇒ Struct

Returns a new instance of Struct.



19
20
21
# File 'lib/steam/id/struct.rb', line 19

def initialize(data = 0)
  @data = data.to_i
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



5
6
7
# File 'lib/steam/id/struct.rb', line 5

def data
  @data
end

Instance Method Details

#account_idInteger

Gets the account id

Returns:

  • the account id



31
32
33
# File 'lib/steam/id/struct.rb', line 31

def 
  get(0, ACCOUNT_ID_MASK)
end

#account_id=(value) ⇒ Integer

Sets the account_id

Returns:

  • the account id



38
39
40
# File 'lib/steam/id/struct.rb', line 38

def (value)
  set(0, ACCOUNT_ID_MASK, value)
end

#account_typeInteger

Gets the account type

Returns:

  • the account type



57
58
59
# File 'lib/steam/id/struct.rb', line 57

def 
  get(52, ACCOUNT_TYPE_MASK)
end

#account_type=(value) ⇒ Object

Sets the account type



62
63
64
# File 'lib/steam/id/struct.rb', line 62

def (value)
  set(52, ACCOUNT_TYPE_MASK, value)
end

#instanceInteger

Gets the instance

Returns:

  • the account id



45
46
47
# File 'lib/steam/id/struct.rb', line 45

def instance
  get(32, INSTANCE_MASK)
end

#instance=(value) ⇒ Object

Sets the instance



50
51
52
# File 'lib/steam/id/struct.rb', line 50

def instance=(value)
  set(32, INSTANCE_MASK, value)
end

#to_iObject

Returns the internal integer



24
25
26
# File 'lib/steam/id/struct.rb', line 24

def to_i
  @data.to_i
end

#universeInteger

Gets the universe

Returns:

  • the universe



69
70
71
# File 'lib/steam/id/struct.rb', line 69

def universe
  get(56, UNIVERSE_MASK)
end

#universe=(value) ⇒ Object

Sets the universe



74
75
76
# File 'lib/steam/id/struct.rb', line 74

def universe=(value)
  set(56, UNIVERSE_MASK, value)
end