class KBSecret::Record::Environment

Represents a record containing an environment variable and value.

Public Instance Methods

load!() click to toggle source

Load this record's environment variable into the environment of the current process. @return [void]

# File lib/kbsecret/record/environment.rb, line 37
def load!
  ENV[variable] = value
end
populate_internal_fields() click to toggle source

@return [void] @see Abstract#populate_internal_fields

# File lib/kbsecret/record/environment.rb, line 18
def populate_internal_fields
  defer_sync implicit: false do
    self.variable = variable.shellescape
    self.value = value.shellescape
  end
end
to_assignment() click to toggle source

@return [String] a sh-style environment assignment

# File lib/kbsecret/record/environment.rb, line 26
def to_assignment
  "#{variable}=#{value}"
end
to_export() click to toggle source

@return [String] a sh-style environment export line

# File lib/kbsecret/record/environment.rb, line 31
def to_export
  "export #{to_assignment}"
end