instance method require

Ruby on Rails edge

Since edge

Signature

require(*key)

Find singular or nested keys. Raises KeyError if not found or nil.

Given configuration:

db_port: null
database:
  host: "db.example.com"

Examples:

require(:database, :host) # => "db.example.com"
require(:missing)         # => KeyError
require(:db_port)         # => KeyError (nil values are treated as missing)

Parameters

key rest
Source
# File activesupport/lib/active_support/encrypted_configuration.rb, line 83
    def require(*key)
      value = dig(*key)

      if !value.nil?
        value
      else
        raise KeyError, "Missing key: #{key.inspect}"
      end
    end

Defined in activesupport/lib/active_support/encrypted_configuration.rb line 83 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveSupport::EncryptedConfiguration

Type at least 2 characters to search.

Use the arrow keys to navigate results, Enter to open one, Escape to close.

Keyboard shortcuts

/
Focus search
⌘K / Ctrl-K
Command palette
?
This help
Esc
Close