Class: Rugo::RugoBase

Inherits:
Object
  • Object
show all
Defined in:
lib/rugo.rb

Instance Method Summary collapse

Constructor Details

#initializeRugoBase

Returns a new instance of RugoBase.



39
40
41
42
43
44
# File 'lib/rugo.rb', line 39

def initialize
  @router = Router.new
  routes.each do |route|
    @router.match route[:method], route[:pattern], route[:handler]
  end
end

Instance Method Details

#call(env) ⇒ Object



46
47
48
# File 'lib/rugo.rb', line 46

def call(env)
  @router.execute(env)
end

#routesObject



50
51
52
53
54
# File 'lib/rugo.rb', line 50

def routes
  [
    {method: 'GET', pattern: '/', handler: HelloHandler},
  ]
end