Sha256: b68ac1f4428ab993b7964c32c98e59bf188e15331a8dfbf9e3a45fdf876af5b5

Contents?: true

Size: 459 Bytes

Versions: 12

Compression:

Stored size: 459 Bytes

Contents

require 'yaml'

module Gurney
  class Config

    attr_accessor :branches, :api_url, :api_token, :project_id

    def initialize(branches: nil, api_url: nil, api_token: nil, project_id: nil)
      @branches = branches
      @api_url = api_url
      @api_token = api_token&.to_s
      @project_id = project_id&.to_s
    end

    def self.from_yaml(yaml)
        config = YAML.load(yaml)&.map{|(k,v)| [k.to_sym,v]}.to_h
        new(**config)
    end

  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
gurney_client-0.4.0 lib/gurney/config.rb
gurney_client-0.3.0 lib/gurney/config.rb
gurney_client-0.2.3 lib/gurney/config.rb
gurney_client-0.2.2 lib/gurney/config.rb
gurney_client-0.2.1 lib/gurney/config.rb
gurney_client-0.2.0 lib/gurney/config.rb
gurney_client-0.1.6 lib/gurney/config.rb
gurney_client-0.1.5 lib/gurney/config.rb
gurney_client-0.1.4 lib/gurney/config.rb
gurney_client-0.1.3 lib/gurney/config.rb
gurney_client-0.1.2 lib/gurney/config.rb
gurney_client-0.1.1 lib/gurney/config.rb