class EnvParameterStore::Config

Public Class Methods

new(config_json) click to toggle source
# File lib/env_parameter_store.rb, line 78
def initialize(config_json)
  unless config_json.key?('prefix') \
      && config_json.key?('parameters') \
      && config_json.fetch('prefix').is_a?(String) \
      && config_json.fetch('parameters').is_a?(Array) \
      && config_json.fetch('parameters').all? { |key| key.is_a?(String) }
    raise EnvParameterStore::InvalidJSONError.new
  end

  prefix = config_json.fetch('prefix')
  @qualified_names_to_names = config_json.fetch('parameters').each_with_object({}) do |key, table|
    table[prefix + key] = key
  end
end

Public Instance Methods

parameter_names() click to toggle source
# File lib/env_parameter_store.rb, line 97
def parameter_names
  @qualified_names_to_names.keys
end
to_name(qualified_name) click to toggle source
# File lib/env_parameter_store.rb, line 93
def to_name(qualified_name)
  @qualified_names_to_names.fetch(qualified_name)
end