Module: Typekitable::Tokenizer

Defined in:
lib/typekitable/tokenizer.rb

Constant Summary collapse

TOKEN_STORE =
File.absolute_path('.typekitable', Dir.home)

Class Method Summary collapse

Class Method Details

.get_tokenObject



15
16
17
18
19
20
21
# File 'lib/typekitable/tokenizer.rb', line 15

def self.get_token
  return unless has_token?

  File.open(TOKEN_STORE, 'r') do |file|
    file.gets
  end
end

.has_token?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/typekitable/tokenizer.rb', line 11

def self.has_token?
  File.exist?(TOKEN_STORE)
end

.store(token) ⇒ Object



5
6
7
8
9
# File 'lib/typekitable/tokenizer.rb', line 5

def self.store(token)
  File.open(TOKEN_STORE, 'w') do |file|
    file.write(token)
  end
end