Added Route file and class
This commit is contained in:
parent
b797a282f5
commit
12653f6f48
3 changed files with 31 additions and 0 deletions
21
lib/route.rb
21
lib/route.rb
|
|
@ -0,0 +1,21 @@
|
|||
class Route
|
||||
attr_reader :routes
|
||||
def initialize()
|
||||
@routes = {}
|
||||
end
|
||||
|
||||
def add_route(input)
|
||||
@routes.merge!(input)
|
||||
p "added successfully, @routes are: #{@routes}"
|
||||
end
|
||||
|
||||
def match_route(input)
|
||||
resource = input.resource
|
||||
if @routes[resource]
|
||||
return @routes[resource]
|
||||
else
|
||||
p "failed to find: #{resource} route"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue