Method: Grape::DSL::Settings#top_level_setting

Defined in:
lib/grape/dsl/settings.rb

#top_level_settingObject

Fetch our top-level settings, which apply to all endpoints in the API.



13
14
15
16
17
18
19
20
21
# File 'lib/grape/dsl/settings.rb', line 13

def top_level_setting
  @top_level_setting ||= Grape::Util::InheritableSetting.new.tap do |setting|
    # Doesn't try to inherit settings from +Grape::API::Instance+ which also responds to
    # +inheritable_setting+, however, it doesn't contain any user-defined settings.
    # Otherwise, it would lead to an extra instance of +Grape::Util::InheritableSetting+
    # in the chain for every endpoint.
    setting.inherit_from superclass.inheritable_setting if defined?(superclass) && superclass.respond_to?(:inheritable_setting) && superclass != Grape::API::Instance
  end
end