Class: Angelo::Base::RouteMap

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

Instance Method Summary collapse

Constructor Details

#initializeRouteMap

Returns a new instance of RouteMap.



396
397
398
# File 'lib/angelo/base.rb', line 396

def initialize
  @hash = Hash.new
end

Instance Method Details

#[](route) ⇒ Object



404
405
406
407
408
409
410
411
# File 'lib/angelo/base.rb', line 404

def [] route
  responder = nil
  if mustermann = @hash.keys.select {|k| k.match(route)}.first
    responder = @hash.fetch mustermann
    responder.mustermann = mustermann
  end
  responder
end

#[]=(route, responder) ⇒ Object



400
401
402
# File 'lib/angelo/base.rb', line 400

def []= route, responder
  @hash[route] = responder
end