Class: AgentCliRuntime::PreparedInvocation
- Inherits:
-
Object
- Object
- AgentCliRuntime::PreparedInvocation
- Defined in:
- lib/agent_cli_runtime/values.rb
Instance Attribute Summary collapse
-
#configuration_path ⇒ Object
readonly
Returns the value of attribute configuration_path.
-
#configuration_source ⇒ Object
readonly
Returns the value of attribute configuration_source.
-
#credential_environment_keys ⇒ Object
readonly
Returns the value of attribute credential_environment_keys.
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#executable ⇒ Object
readonly
Returns the value of attribute executable.
-
#generated_paths ⇒ Object
readonly
Returns the value of attribute generated_paths.
-
#invocation ⇒ Object
readonly
Returns the value of attribute invocation.
-
#invocation_root ⇒ Object
readonly
Returns the value of attribute invocation_root.
-
#probe_result ⇒ Object
readonly
Returns the value of attribute probe_result.
-
#requested_route ⇒ Object
readonly
Returns the value of attribute requested_route.
Instance Method Summary collapse
- #cleanup! ⇒ Object
- #environment_for(env: ENV) ⇒ Object
-
#initialize(invocation:, environment:, credential_environment_keys:, invocation_root:, generated_paths:, configuration_path:, requested_route:, configuration_source:, probe_result:, cleanup:, executable: nil) ⇒ PreparedInvocation
constructor
A new instance of PreparedInvocation.
Constructor Details
#initialize(invocation:, environment:, credential_environment_keys:, invocation_root:, generated_paths:, configuration_path:, requested_route:, configuration_source:, probe_result:, cleanup:, executable: nil) ⇒ PreparedInvocation
Returns a new instance of PreparedInvocation.
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 |
# File 'lib/agent_cli_runtime/values.rb', line 374 def initialize(invocation:, environment:, credential_environment_keys:, invocation_root:, generated_paths:, configuration_path:, requested_route:, configuration_source:, probe_result:, cleanup:, executable: nil) @invocation = invocation @environment = Immutable.hash(environment) @credential_environment_keys = Immutable.strings(credential_environment_keys) @invocation_root = Immutable.string(invocation_root) @generated_paths = Immutable.strings(generated_paths) @configuration_path = Immutable.string(configuration_path) @requested_route = requested_route @configuration_source = configuration_source.nil? ? nil : Immutable.string(configuration_source) @probe_result = probe_result @executable = Immutable.string(executable || invocation.argv.fetch(0)) @cleanup = cleanup freeze end |
Instance Attribute Details
#configuration_path ⇒ Object (readonly)
Returns the value of attribute configuration_path.
369 370 371 |
# File 'lib/agent_cli_runtime/values.rb', line 369 def configuration_path @configuration_path end |
#configuration_source ⇒ Object (readonly)
Returns the value of attribute configuration_source.
369 370 371 |
# File 'lib/agent_cli_runtime/values.rb', line 369 def configuration_source @configuration_source end |
#credential_environment_keys ⇒ Object (readonly)
Returns the value of attribute credential_environment_keys.
369 370 371 |
# File 'lib/agent_cli_runtime/values.rb', line 369 def credential_environment_keys @credential_environment_keys end |
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
369 370 371 |
# File 'lib/agent_cli_runtime/values.rb', line 369 def environment @environment end |
#executable ⇒ Object (readonly)
Returns the value of attribute executable.
369 370 371 |
# File 'lib/agent_cli_runtime/values.rb', line 369 def executable @executable end |
#generated_paths ⇒ Object (readonly)
Returns the value of attribute generated_paths.
369 370 371 |
# File 'lib/agent_cli_runtime/values.rb', line 369 def generated_paths @generated_paths end |
#invocation ⇒ Object (readonly)
Returns the value of attribute invocation.
369 370 371 |
# File 'lib/agent_cli_runtime/values.rb', line 369 def invocation @invocation end |
#invocation_root ⇒ Object (readonly)
Returns the value of attribute invocation_root.
369 370 371 |
# File 'lib/agent_cli_runtime/values.rb', line 369 def invocation_root @invocation_root end |
#probe_result ⇒ Object (readonly)
Returns the value of attribute probe_result.
369 370 371 |
# File 'lib/agent_cli_runtime/values.rb', line 369 def probe_result @probe_result end |
#requested_route ⇒ Object (readonly)
Returns the value of attribute requested_route.
369 370 371 |
# File 'lib/agent_cli_runtime/values.rb', line 369 def requested_route @requested_route end |
Instance Method Details
#cleanup! ⇒ Object
402 403 404 405 |
# File 'lib/agent_cli_runtime/values.rb', line 402 def cleanup! @cleanup.call nil end |
#environment_for(env: ENV) ⇒ Object
394 395 396 397 398 399 400 |
# File 'lib/agent_cli_runtime/values.rb', line 394 def environment_for(env: ENV) selected = credential_environment_keys.each_with_object({}) do |key, values| value = env[key] values[key] = value.to_s unless value.to_s.empty? end selected.merge(environment).freeze end |