Class: Fasta::Router

Inherits:
Object
  • Object
show all
Defined in:
lib/fasta/services/router.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRouter

Returns a new instance of Router.



6
7
8
9
10
11
12
13
14
15
# File 'lib/fasta/services/router.rb', line 6

def initialize
  @router = Hanami::Router.new do
    action = ->(klass) { ->(env) { klass.call(env) } }
    root to: ->(_env) { [200, {}, ['Welcome to API']] }

    mapper = Fasta::RoutesMapper.new(action, self)

    yield(mapper)
  end
end

Instance Attribute Details

#routerObject (readonly)

Returns the value of attribute router.



21
22
23
# File 'lib/fasta/services/router.rb', line 21

def router
  @router
end

Instance Method Details

#runnableObject



17
18
19
# File 'lib/fasta/services/router.rb', line 17

def runnable
  router
end