module Gist::ClipboardError::AuthTokenFile

helper module for authentication token actions

Public Class Methods

filename() click to toggle source
# File lib/gist.rb, line 49
def self.filename
  if ENV.key?(URL_ENV_NAME)
    File.expand_path "~/.gist.#{ENV[URL_ENV_NAME].gsub(/:/, '.').gsub(/[^a-z0-9.-]/, '')}"
  else
    File.expand_path "~/.gist"
  end
end
read() click to toggle source
# File lib/gist.rb, line 57
def self.read
  File.read(filename).chomp
end
write(token) click to toggle source
# File lib/gist.rb, line 61
def self.write(token)
  File.open(filename, 'w', 0600) do |f|
    f.write token
  end
end