Sha256: f9fcdc885ab621b0b503b0bf7b17a7a581a665deeab5d8838c811fd960095479

Contents?: true

Size: 469 Bytes

Versions: 11

Compression:

Stored size: 469 Bytes

Contents

class Jets::Gems::Config
  class Token
    def key
      data['key']
    end

    def data
      load_yaml("#{ENV['HOME']}/.jets/config.yml")
    end

    # Ensure a Hash is returned
    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
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
serverlessgems-0.4.0 lib/jets/gems/config/token.rb
serverlessgems-0.3.0 lib/jets/gems/config/token.rb
serverlessgems-0.2.1 lib/jets/gems/config/token.rb
serverlessgems-0.2.0 lib/jets/gems/config/token.rb
serverlessgems-0.1.6 lib/jets/gems/config/token.rb
serverlessgems-0.1.5 lib/jets/gems/config/token.rb
serverlessgems-0.1.4 lib/jets/gems/config/token.rb
serverlessgems-0.1.3 lib/jets/gems/config/token.rb
serverlessgems-0.1.2 lib/jets/gems/config/token.rb
serverlessgems-0.1.1 lib/jets/gems/config/token.rb
serverlessgems-0.1.0 lib/jets/gems/config/token.rb