Class: AgentCliRuntime::InspectionCommand

Inherits:
Data
  • Object
show all
Defined in:
lib/agent_cli_runtime/values.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv:, environment:, credential_environment_keys:, session_id:, message_id:, stdin_data: nil) ⇒ InspectionCommand

Returns a new instance of InspectionCommand.



537
538
539
540
541
542
543
544
545
546
547
548
# File 'lib/agent_cli_runtime/values.rb', line 537

def initialize(argv:, environment:, credential_environment_keys:,
               session_id:, message_id:, stdin_data: nil)
  super(
    argv: Immutable.strings(argv),
    stdin_data: stdin_data.nil? ? nil : Immutable.string(stdin_data),
    environment: Immutable.hash(environment),
    credential_environment_keys:
      Immutable.strings(credential_environment_keys),
    session_id: Immutable.string(session_id),
    message_id: Immutable.string(message_id)
  )
end

Instance Attribute Details

#argvObject (readonly)

Returns the value of attribute argv

Returns:

  • (Object)

    the current value of argv



533
534
535
# File 'lib/agent_cli_runtime/values.rb', line 533

def argv
  @argv
end

#credential_environment_keysObject (readonly)

Returns the value of attribute credential_environment_keys

Returns:

  • (Object)

    the current value of credential_environment_keys



533
534
535
# File 'lib/agent_cli_runtime/values.rb', line 533

def credential_environment_keys
  @credential_environment_keys
end

#environmentObject (readonly)

Returns the value of attribute environment

Returns:

  • (Object)

    the current value of environment



533
534
535
# File 'lib/agent_cli_runtime/values.rb', line 533

def environment
  @environment
end

#message_idObject (readonly)

Returns the value of attribute message_id

Returns:

  • (Object)

    the current value of message_id



533
534
535
# File 'lib/agent_cli_runtime/values.rb', line 533

def message_id
  @message_id
end

#session_idObject (readonly)

Returns the value of attribute session_id

Returns:

  • (Object)

    the current value of session_id



533
534
535
# File 'lib/agent_cli_runtime/values.rb', line 533

def session_id
  @session_id
end

#stdin_dataObject (readonly)

Returns the value of attribute stdin_data

Returns:

  • (Object)

    the current value of stdin_data



533
534
535
# File 'lib/agent_cli_runtime/values.rb', line 533

def stdin_data
  @stdin_data
end

Instance Method Details

#environment_for(env: ENV) ⇒ Object



550
551
552
553
554
555
556
# File 'lib/agent_cli_runtime/values.rb', line 550

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