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
- #getDepot(depotID) ⇒ Object
-
#initialize(sharedDepots = {}) ⇒ SharedDepots
constructor
A new instance of SharedDepots.
- #load(sharedDepots) ⇒ Object
- #remove(depot) ⇒ Object
- #set(depot, baseDepot) ⇒ Object
Constructor Details
#initialize(sharedDepots = {}) ⇒ SharedDepots
Returns a new instance of SharedDepots.
138 139 140 |
# File 'lib/steam_codec/ACF.rb', line 138 def initialize(sharedDepots = {}) load(sharedDepots) end |
Instance Attribute Details
#Depots ⇒ Object (readonly)
Returns the value of attribute Depots.
137 138 139 |
# File 'lib/steam_codec/ACF.rb', line 137 def Depots @Depots end |
Instance Method Details
#depots ⇒ Object
150 151 152 |
# File 'lib/steam_codec/ACF.rb', line 150 def depots @SharedDepots.keys end |
#getDepot(depotID) ⇒ Object
154 155 156 157 158 159 |
# File 'lib/steam_codec/ACF.rb', line 154 def getDepot(depotID) @SharedDepots.each do |depot, baseDepot| return baseDepot if depot == depotID end nil end |
#load(sharedDepots) ⇒ Object
142 143 144 145 146 147 148 |
# File 'lib/steam_codec/ACF.rb', line 142 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
165 166 167 |
# File 'lib/steam_codec/ACF.rb', line 165 def remove(depot) @SharedDepots.delete(depot) end |
#set(depot, baseDepot) ⇒ Object
161 162 163 |
# File 'lib/steam_codec/ACF.rb', line 161 def set(depot, baseDepot) @SharedDepots[depot] = baseDepot end |