Method: Grape::API::Instance#initialize

Defined in:
lib/grape/api/instance.rb

#initializeInstance

Builds the routes from the defined endpoints, effectively compiling this API into a usable form.



131
132
133
134
135
136
137
138
139
140
# File 'lib/grape/api/instance.rb', line 131

def initialize
  @router = Router.new
  add_head_not_allowed_methods_and_options_methods
  self.class.endpoints.each do |endpoint|
    endpoint.mount_in(@router)
  end

  @router.compile!
  @router.freeze
end