Module: Grape::DSL::Configuration

Extended by:
ActiveSupport::Concern
Included in:
API, Callbacks, Helpers, Middleware, RequestResponse, Routing, Validations
Defined in:
lib/grape/dsl/configuration.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Class Method Details

.desc_containerObject


48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/grape/dsl/configuration.rb', line 48

def desc_container
  Module.new do
    include Grape::Util::StrictHashConfiguration.module(
                :description,
                :detail,
                :params,
                :entity,
                :http_codes,
                :named,
                :headers
    )

    def config_context.success(*args)
      entity(*args)
    end

    def config_context.failure(*args)
      http_codes(*args)
    end
  end
end

.stacked_hash_to_hash(settings) ⇒ Object


43
44
45
46
# File 'lib/grape/dsl/configuration.rb', line 43

def stacked_hash_to_hash(settings)
  return nil if settings.nil? || settings.blank?
  settings.each_with_object(ActiveSupport::OrderedHash.new) { |value, result| result.deep_merge!(value) }
end