Sha256: c07153446e7a30bda54a50bbaa00ddaf5f324b5164ce38fd4fd012e358db31c3
Contents?: true
Size: 679 Bytes
Versions: 31
Compression:
Stored size: 679 Bytes
Contents
# frozen_string_literal: true require 'json' require 'uffizzi/helpers/file_helper' module Uffizzi class Token TOKEN_PATH = "#{Dir.home}/.config/uffizzi/token" class << self def token_path TOKEN_PATH end def delete File.truncate(token_path, 0) if exists? end def exists? File.exist?(token_path) && !read.nil? end def read content = File.read(token_path) content.presence rescue Errno::ENOENT nil end def write(token) return nil unless token.is_a?(String) Uffizzi::FileHelper.write_with_lock(token_path, token) end end end end
Version data entries
31 entries across 31 versions & 1 rubygems