Sha256: 85cf7ff3e772c8d1e333638637bada7fda7c8e818b946de6ce2d05b8c46b9a9e
Contents?: true
Size: 622 Bytes
Versions: 11
Compression:
Stored size: 622 Bytes
Contents
# frozen_string_literal: true require 'pathname' module Cased module CLI class Authentication attr_reader :directory attr_reader :credentials_path attr_writer :token def initialize(token: nil) @token = token || Cased.config.guard_user_token @directory = Pathname.new(File.expand_path('~/.cguard')) @credentials_path = @directory.join('credentials') end def exists? !token.nil? end def token @token ||= begin credentials_path.read rescue Errno::ENOENT nil end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems