Module: EnvironmentConfig::TypeFetcherMethods::ClassMethods

Defined in:
lib/environment_config/type_fetcher_methods.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args) ⇒ Object



15
16
17
18
19
20
21
22
23
# 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

Instance Method Details

#respond_to_missing?(method_name, *_args) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
28
# 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