Class: SteamCodec::ACF::SharedDepots

Inherits:
Object
  • Object
show all
Defined in:
lib/steam_codec/acf.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sharedDepots = {}) ⇒ SharedDepots

Returns a new instance of SharedDepots.



139
140
141
# File 'lib/steam_codec/acf.rb', line 139

def initialize(sharedDepots = {})
    load(sharedDepots)
end

Instance Attribute Details

#DepotsObject (readonly)

Returns the value of attribute Depots.



138
139
140
# File 'lib/steam_codec/acf.rb', line 138

def Depots
  @Depots
end

Instance Method Details

#depotsObject



151
152
153
# File 'lib/steam_codec/acf.rb', line 151

def depots
    @SharedDepots.keys
end

#getDepot(depotID) ⇒ Object



155
156
157
158
159
160
# File 'lib/steam_codec/acf.rb', line 155

def getDepot(depotID)
    @SharedDepots.each do |depot, baseDepot|
        return baseDepot if depot == depotID
    end
    nil
end

#load(sharedDepots) ⇒ Object

Raises:

  • (ArgumentError)


143
144
145
146
147
148
149
# File 'lib/steam_codec/acf.rb', line 143

def load(sharedDepots)
    raise ArgumentError, "SharedDepots must be instance of Hash" unless sharedDepots.is_a?(Hash)
    @SharedDepots = {}
    sharedDepots.each do |depot, baseDepot|
        @SharedDepots[depot.to_i] = baseDepot.to_i
    end
end

#remove(depot) ⇒ Object



166
167
168
# File 'lib/steam_codec/acf.rb', line 166

def remove(depot)
    @SharedDepots.delete(depot)
end

#set(depot, baseDepot) ⇒ Object



162
163
164
# File 'lib/steam_codec/acf.rb', line 162

def set(depot, baseDepot)
    @SharedDepots[depot] = baseDepot
end