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.



213
214
215
# File 'lib/steam_codec/acf.rb', line 213

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

Instance Attribute Details

#DepotsObject (readonly)

Returns the value of attribute Depots.



212
213
214
# File 'lib/steam_codec/acf.rb', line 212

def Depots
  @Depots
end

Instance Method Details

#depotsObject



229
230
231
# File 'lib/steam_codec/acf.rb', line 229

def depots
    @SharedDepots.keys
end

#get(path = '', seperator = '.') ⇒ Object



225
226
227
# File 'lib/steam_codec/acf.rb', line 225

def get(path = '', seperator = '.')
    @SharedDepots[path.to_i]
end

#getDepot(depotID) ⇒ Object



233
234
235
236
237
238
# File 'lib/steam_codec/acf.rb', line 233

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

#load(sharedDepots) ⇒ Object

Raises:

  • (ArgumentError)


217
218
219
220
221
222
223
# File 'lib/steam_codec/acf.rb', line 217

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



244
245
246
# File 'lib/steam_codec/acf.rb', line 244

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

#set(depot, baseDepot) ⇒ Object



240
241
242
# File 'lib/steam_codec/acf.rb', line 240

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

#to_hashObject



248
249
250
# File 'lib/steam_codec/acf.rb', line 248

def to_hash
    @SharedDepots
end