Class: JwkLoader::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/jwk_loader/config/config.rb

Defined Under Namespace

Classes: ConfigurationNotFound

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



19
20
21
22
23
# File 'lib/jwk_loader/config/config.rb', line 19

def method_missing(name, *args)
  return send(:[]=, name.to_s[0..-2].to_sym, *args) if name.to_s.end_with?("=")

  send(:[], name, *args)
end

Instance Method Details

#[](key) ⇒ Object



15
16
17
# File 'lib/jwk_loader/config/config.rb', line 15

def [](key)
  registry[key] || (raise ConfigurationNotFound, key)
end

#[]=(key, value) ⇒ Object



11
12
13
# File 'lib/jwk_loader/config/config.rb', line 11

def []=(key, value)
  registry[key] = value
end

#respond_to_missing?(name, _include_private) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
28
29
30
# File 'lib/jwk_loader/config/config.rb', line 25

def respond_to_missing?(name, _include_private)
  # Don't claim to respond to Ruby's internal methods
  return false if name.to_s.start_with?("instance_variables_")

  true
end