module EnvironmentConfig::TypeFetcherMethods::ClassMethods

Public Instance Methods

method_missing(method_name, *args) click to toggle source
Calls superclass method
# File lib/environment_config/type_fetcher_methods.rb, line 15
def method_missing(method_name, *args)
  type = type_of_fetch_method(method_name)
  if type && Types.known_type?(type)
    key = args.shift
    TypedEnv.fetch(type, key, *args)
  else
    super
  end
end
respond_to_missing?(method_name, *_args) click to toggle source
Calls superclass method
# File lib/environment_config/type_fetcher_methods.rb, line 25
def respond_to_missing?(method_name, *_args)
  type = type_of_fetch_method(method_name)
  (type && Types.known_type?(type)) || super
end

Private Instance Methods

type_of_fetch_method(method_name) click to toggle source
# File lib/environment_config/type_fetcher_methods.rb, line 32
def type_of_fetch_method(method_name)
  match = /\Afetch_(.+)/.match(method_name)
  return nil unless match

  match[1]
end