Class: Bolt::Plugin::EnvVar
- Inherits:
-
Object
- Object
- Bolt::Plugin::EnvVar
- Defined in:
- lib/bolt/plugin/env_var.rb
Instance Method Summary collapse
- #hooks ⇒ Object
-
#initialize(*_args) ⇒ EnvVar
constructor
A new instance of EnvVar.
- #name ⇒ Object
- #resolve_reference(opts) ⇒ Object
- #validate_resolve_reference(opts) ⇒ Object
Constructor Details
#initialize(*_args) ⇒ EnvVar
Returns a new instance of EnvVar.
6 |
# File 'lib/bolt/plugin/env_var.rb', line 6 def initialize(*_args); end |
Instance Method Details
#hooks ⇒ Object
12 13 14 |
# File 'lib/bolt/plugin/env_var.rb', line 12 def hooks %i[resolve_reference validate_resolve_reference] end |
#name ⇒ Object
8 9 10 |
# File 'lib/bolt/plugin/env_var.rb', line 8 def name 'env_var' end |
#resolve_reference(opts) ⇒ Object
25 26 27 |
# File 'lib/bolt/plugin/env_var.rb', line 25 def resolve_reference(opts) ENV[opts['var']] end |
#validate_resolve_reference(opts) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/bolt/plugin/env_var.rb', line 16 def validate_resolve_reference(opts) unless opts['var'] raise Bolt::ValidationError, "env_var plugin requires that the 'var' is specified" end unless ENV[opts['var']] raise Bolt::ValidationError, "env_var plugin requires that the var '#{opts['var']}' be set" end end |