class RanchHand::Storage

Public Instance Methods

get(key) click to toggle source
# File lib/ranch_hand/storage.rb, line 3
def get(key)
  store[key]
end
set(key, val) click to toggle source
# File lib/ranch_hand/storage.rb, line 7
def set(key, val)
  store[key] = val
  save
end

Private Instance Methods

save() click to toggle source
# File lib/ranch_hand/storage.rb, line 18
def save
  File.open(RanchHand::STORE_FILE, 'w', 0640) do |f|
    f.write(store.to_yaml)
  end
end
store() click to toggle source
# File lib/ranch_hand/storage.rb, line 14
def store
  @store ||= YAML.load_file(RanchHand::STORE_FILE) || {}
end