Module: Grape::DSL::Configuration::ClassMethods

Includes:
Settings
Defined in:
lib/grape/dsl/configuration.rb

Instance Attribute Summary collapse

Attributes included from Settings

#inheritable_setting, #top_level_setting

Instance Method Summary collapse

Methods included from Settings

#api_class_setting, #get_or_set, #global_setting, #namespace_end, #namespace_inheritable, #namespace_inheritable_to_nil, #namespace_setting, #namespace_stackable, #namespace_start, #route_end, #route_setting, #unset, #unset_api_class_setting, #unset_global_setting, #unset_namespace_inheritable, #unset_namespace_setting, #unset_namespace_stackable, #unset_route_setting, #within_namespace

Instance Attribute Details

#logger(logger = nil) ⇒ Object


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

def logger(logger = nil)
  if logger
    global_setting(:logger, logger)
  else
    global_setting(:logger) || global_setting(:logger, Logger.new($stdout))
  end
end

Instance Method Details

#desc(description, options = {}, &config_block) ⇒ Object

Add a description to the next namespace or function.


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/grape/dsl/configuration.rb', line 22

def desc(description, options = {}, &config_block)
  if block_given?
    config_class = Grape::DSL::Configuration.desc_container

    config_class.configure do
      description description
    end

    config_class.configure(&config_block)
    options = config_class.settings
  else
    options = options.merge(description: description)
  end

  namespace_setting :description, options
  route_setting :description, options
end