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.
139 140 141 |
# File 'lib/steam_codec/acf.rb', line 139 def initialize(sharedDepots = {}) load(sharedDepots) end |
Instance Attribute Details
#Depots ⇒ Object (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
#depots ⇒ Object
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
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 |