Class: IOSBox::Cache

Inherits:
Object
  • Object
show all
Defined in:
lib/ios-box/iosbox.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCache

Returns a new instance of Cache.



226
227
228
# File 'lib/ios-box/iosbox.rb', line 226

def initialize
  @cache = {}
end

Instance Attribute Details

#cacheObject

Returns the value of attribute cache.



214
215
216
# File 'lib/ios-box/iosbox.rb', line 214

def cache
  @cache
end

Class Method Details

.load(file = ".buildcache") ⇒ Object



216
217
218
219
220
221
222
223
224
# File 'lib/ios-box/iosbox.rb', line 216

def self.load(file = ".buildcache")
  cache = Cache.new

  if File.exists?(file)
    cache.cache = YAML.load(File.read(file))
  end

  cache
end

Instance Method Details

#[](v) ⇒ Object



230
231
232
# File 'lib/ios-box/iosbox.rb', line 230

def [](v)
  @cache[v]
end

#[]=(v, s) ⇒ Object



234
235
236
# File 'lib/ios-box/iosbox.rb', line 234

def []=(v, s)
  @cache[v] = s
end

#save(file = ".buildcache") ⇒ Object



238
239
240
# File 'lib/ios-box/iosbox.rb', line 238

def save(file = ".buildcache")
  File.open(file, 'w') { |io| io.puts @cache.to_yaml }
end