module CacheEnvironment

Public Instance Methods

environment_cache_path() click to toggle source
# File lib/tacoma/cache_environment.rb, line 2
def environment_cache_path
  "#{Dir.home}/.tacoma_current_environment"
end
read_environment_from_cache() click to toggle source
# File lib/tacoma/cache_environment.rb, line 12
def read_environment_from_cache
  str = begin
    File.open(environment_cache_path, &:readline)
  rescue StandardError
    nil
  end
  str
end
update_environment_to_cache(environment) click to toggle source
# File lib/tacoma/cache_environment.rb, line 6
def update_environment_to_cache(environment)
  File.open(environment_cache_path, 'w') { |file| file.write(environment) }
rescue StandardError
  puts "Cannot write at #{environment_cache_path}"
end