Class: CC::CLI::FileStore

Inherits:
Object
  • Object
show all
Defined in:
lib/cc/cli/file_store.rb

Direct Known Subclasses

GlobalCache, GlobalConfig

Instance Method Summary collapse

Constructor Details

#initializeFileStore

This class is not supposed to be directly used. It should be sublcassed and a few constants need to be defined on the sublass to be usable.

FILE_NAME is the name of the file this class wraps.



12
13
14
# File 'lib/cc/cli/file_store.rb', line 12

def initialize
  load_data
end

Instance Method Details

#saveObject



16
17
18
19
20
21
22
23
24
# File 'lib/cc/cli/file_store.rb', line 16

def save
  return false unless File.exist? self.class::FILE_NAME

  File.open(self.class::FILE_NAME, "w") do |f|
    YAML.dump data, f
  end

  true
end