class CslCli::Tokenstore
Attributes
path[R]
Public Class Methods
new(path)
click to toggle source
# File lib/csl_cli/tokenstore.rb, line 11 def initialize(path) @path = path @tokenfile = File.join(@path, '.csl_token') end
Public Instance Methods
clear()
click to toggle source
# File lib/csl_cli/tokenstore.rb, line 31 def clear File.delete(@tokenfile) if File.exist?(@tokenfile) return true end
load()
click to toggle source
# File lib/csl_cli/tokenstore.rb, line 16 def load file = File.open(@tokenfile, 'rb') @saved_token = file.read() file.close return @saved_token end
store(token)
click to toggle source
# File lib/csl_cli/tokenstore.rb, line 23 def store(token) file = File.open(@tokenfile, 'w') file.write(token) file.close File.chmod(0600, @tokenfile) return true end