Class: SteamCodec::ACF::SharedDepots
- Inherits:
-
Object
- Object
- SteamCodec::ACF::SharedDepots
- Defined in:
- lib/steam_codec/acf.rb
Instance Attribute Summary collapse
-
#Depots ⇒ Object
readonly
Returns the value of attribute Depots.
Instance Method Summary collapse
- #depots ⇒ Object
- #get(path = '', seperator = '.') ⇒ Object
- #getDepot(depotID) ⇒ Object
-
#initialize(sharedDepots = {}) ⇒ SharedDepots
constructor
A new instance of SharedDepots.
- #load(sharedDepots) ⇒ Object
- #remove(depot) ⇒ Object
- #set(depot, baseDepot) ⇒ Object
- #to_hash ⇒ Object
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
#Depots ⇒ Object (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
#depots ⇒ Object
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
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_hash ⇒ Object
248 249 250 |
# File 'lib/steam_codec/acf.rb', line 248 def to_hash @SharedDepots end |