Class: Factorio::Cache
- Inherits:
-
Object
- Object
- Factorio::Cache
- Defined in:
- lib/factorio/mod/cache.rb
Overview
cache mod info
Instance Attribute Summary collapse
-
#gotten ⇒ Object
readonly
Returns the value of attribute gotten.
Instance Method Summary collapse
- #any ⇒ Object
- #download ⇒ Object
-
#initialize(uri, cookie = '') ⇒ Cache
constructor
A new instance of Cache.
- #mod ⇒ Object
Constructor Details
#initialize(uri, cookie = '') ⇒ Cache
Returns a new instance of Cache.
6 7 8 9 10 11 |
# File 'lib/factorio/mod/cache.rb', line 6 def initialize(uri, = '') @uri = uri = @gotten = {} @gotten.default = false end |
Instance Attribute Details
#gotten ⇒ Object (readonly)
Returns the value of attribute gotten.
4 5 6 |
# File 'lib/factorio/mod/cache.rb', line 4 def gotten @gotten end |
Instance Method Details
#any ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/factorio/mod/cache.rb', line 21 def any if gotten[:mod] mod elsif gotten[:download] download else send i[mod download][rand(2)] end end |
#download ⇒ Object
17 18 19 |
# File 'lib/factorio/mod/cache.rb', line 17 def download get :download, "#{@uri}/downloads" end |
#mod ⇒ Object
13 14 15 |
# File 'lib/factorio/mod/cache.rb', line 13 def mod get :mod, @uri end |