Method: Mongoid::Config::Introspection#options

Defined in:
lib/mongoid/config/introspection.rb

#options(include_deprecated: false) ⇒ Array<Introspection::Option>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Extracts the available configuration options from the Mongoid::Config source file, and returns them as an array of hashes.

Parameters:

  • include_deprecated (true | false) (defaults to: false)

    Whether deprecated options should be included in the list. (Default: false)

Returns:

  • (Array<Introspection::Option>)

    ] the array of option objects representing each defined option, in alphabetical order by name.



142
143
144
145
146
147
148
# File 'lib/mongoid/config/introspection.rb', line 142

def options(include_deprecated: false)
  src = File.read(CONFIG_RB_PATH)
  src.scan(OPTION_PATTERN)
    .map { |opt| Option.from_captures(opt) }
    .reject { |opt| !include_deprecated && opt.deprecated? }
    .sort_by { |opt| opt.name }
end