class Jets::Gems::Config::Token

Public Instance Methods

data() click to toggle source
# File lib/jets/gems/config/token.rb, line 7
def data
  load_yaml("#{ENV['HOME']}/.jets/config.yml")
end
key() click to toggle source
# File lib/jets/gems/config/token.rb, line 3
def key
  data['key']
end
load_yaml(path) click to toggle source

Ensure a Hash is returned

# File lib/jets/gems/config/token.rb, line 12
def load_yaml(path)
  return {} unless File.exist?(path)

  data = YAML.load_file(path)
  if data.is_a?(Hash)
    data
  else
    puts "WARN: #{path} is not in the correct format. Loading an empty hash.".color(:yellow)
    {}
  end
end