Sha256: 06cc027ac80e67b650af29f9e81f8408b39b6bb5a64d5912033e9c146d87ec4e
Contents?: true
Size: 1019 Bytes
Versions: 9
Compression:
Stored size: 1019 Bytes
Contents
# frozen_string_literal: true require 'delegate' module AppStoreDevApi class Client class Options < SimpleDelegator attr_reader :kwargs, :config, :env DEFAULTS = { analytics_enabled: true, schema: Schema.new(File.join(__dir__, '..', '..', 'config', 'schema.json')) }.freeze private_constant :DEFAULTS ENV_REGEXP = /APP_STORE_CONNECT_(?<suffix>[A-Z_]+)/.freeze private_constant :ENV_REGEXP def initialize(kwargs = {}) @kwargs = kwargs @config = build_config @env = build_env options = DEFAULTS.merge(@env.merge(@config.merge(kwargs))) super(options) end private def build_config AppStoreDevApi.config.dup end def build_env {}.tap do |hash| ENV.each do |key, value| match = key.match(ENV_REGEXP) next unless match hash[match[:suffix].downcase.to_sym] = value end end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems