Class: CC::CLI::GlobalCache

Inherits:
FileStore show all
Defined in:
lib/cc/cli/global_cache.rb

Constant Summary collapse

FILE_NAME =
"/cache.yml".freeze

Instance Method Summary collapse

Methods inherited from FileStore

#initialize, #save

Constructor Details

This class inherits a constructor from CC::CLI::FileStore

Instance Method Details

#last_version_checkObject

Cache entries



10
11
12
# File 'lib/cc/cli/global_cache.rb', line 10

def last_version_check
  data["last-version-check"] || Time.at(0)
end

#last_version_check=(value) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/cc/cli/global_cache.rb', line 14

def last_version_check=(value)
  data["last-version-check"] =
    if value.is_a? Time
      value
    else
      Time.at(0)
    end
  save
  value
end

#latest_versionObject



25
26
27
# File 'lib/cc/cli/global_cache.rb', line 25

def latest_version
  data["latest-version"]
end

#latest_version=(value) ⇒ Object



29
30
31
32
33
# File 'lib/cc/cli/global_cache.rb', line 29

def latest_version=(value)
  data["latest-version"] = value
  save
  value
end

#outdatedObject Also known as: outdated?



35
36
37
# File 'lib/cc/cli/global_cache.rb', line 35

def outdated
  data["outdated"] == true
end

#outdated=(value) ⇒ Object



40
41
42
43
44
# File 'lib/cc/cli/global_cache.rb', line 40

def outdated=(value)
  data["outdated"] = value == true
  save
  value
end