Class: Gurney::Config
- Inherits:
-
Object
- Object
- Gurney::Config
- Defined in:
- lib/gurney/config.rb
Instance Attribute Summary collapse
-
#api_token ⇒ Object
Returns the value of attribute api_token.
-
#api_url ⇒ Object
Returns the value of attribute api_url.
-
#branches ⇒ Object
Returns the value of attribute branches.
-
#project_id ⇒ Object
Returns the value of attribute project_id.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(branches: nil, api_url: nil, api_token: nil, project_id: nil) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(branches: nil, api_url: nil, api_token: nil, project_id: nil) ⇒ Config
Returns a new instance of Config.
8 9 10 11 12 13 |
# File 'lib/gurney/config.rb', line 8 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 |
Instance Attribute Details
#api_token ⇒ Object
Returns the value of attribute api_token.
6 7 8 |
# File 'lib/gurney/config.rb', line 6 def api_token @api_token end |
#api_url ⇒ Object
Returns the value of attribute api_url.
6 7 8 |
# File 'lib/gurney/config.rb', line 6 def api_url @api_url end |
#branches ⇒ Object
Returns the value of attribute branches.
6 7 8 |
# File 'lib/gurney/config.rb', line 6 def branches @branches end |
#project_id ⇒ Object
Returns the value of attribute project_id.
6 7 8 |
# File 'lib/gurney/config.rb', line 6 def project_id @project_id end |
Class Method Details
.from_yaml(yaml) ⇒ Object
15 16 17 18 |
# File 'lib/gurney/config.rb', line 15 def self.from_yaml(yaml) config = YAML.load(yaml)&.map{|(k,v)| [k.to_sym,v]}.to_h new(**config) end |