Class: Jets::Gems::Config::Token
- Inherits:
-
Object
- Object
- Jets::Gems::Config::Token
- Defined in:
- lib/jets/gems/config/token.rb
Instance Method Summary collapse
- #data ⇒ Object
- #key ⇒ Object
-
#load_yaml(path) ⇒ Object
Ensure a Hash is returned.
Instance Method Details
#data ⇒ Object
7 8 9 |
# File 'lib/jets/gems/config/token.rb', line 7 def data load_yaml("#{ENV["HOME"]}/.jets/config.yml") end |
#key ⇒ Object
3 4 5 |
# File 'lib/jets/gems/config/token.rb', line 3 def key data["key"] end |
#load_yaml(path) ⇒ Object
Ensure a Hash is returned
12 13 14 15 16 17 18 19 20 21 22 |
# 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 |