Module: Hanami::API::DSL

Defined in:
lib/hanami/api/dsl.rb

Overview

Expose Hanami::API features to third party frameworks that need to expose a routing DSL.

Examples:

# framework.rb
 require "hanami/api"

 module Framework
   class App
     def self.inherited(base)
       super
       base.extend(Hanami::API::DSL)
     end
   end
 end

 # app.rb
 require "framework/app"

 class MyApp < Framework::App
   routes do
     root { "Hello, World!" }
   end
 end

 # config.ru
 require_relative "./app"

 run MyApp.new

Since:

  • 0.2.0

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.extended(app) ⇒ Object

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.

Since:

  • 0.2.0



39
40
41
42
43
44
45
# File 'lib/hanami/api/dsl.rb', line 39

def self.extended(app)
  super

  app.extend(ClassMethods)
  app.extend(ClassMethods::Routes)
  app.include(InstanceMethods)
end