summaryrefslogtreecommitdiff
path: root/bocelli/module
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2014-08-18 23:24:32 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2014-08-18 23:24:32 -0700
commit36b3ad8cd10a2635723e847e2c801a1cd8fb5415 (patch)
tree3c01e2a99d86fb9d7680abfeb2432475bbb5b165 /bocelli/module
parent597840b750de571ee87dd34806fe5f188f45d667 (diff)
downloadbocelli-36b3ad8cd10a2635723e847e2c801a1cd8fb5415.tar.gz
bocelli-36b3ad8cd10a2635723e847e2c801a1cd8fb5415.tar.xz
Less code duplication.HEADmaster
Diffstat (limited to 'bocelli/module')
-rw-r--r--bocelli/module/base.rb25
1 files changed, 4 insertions, 21 deletions
diff --git a/bocelli/module/base.rb b/bocelli/module/base.rb
index 45b09d7..f338c34 100644
--- a/bocelli/module/base.rb
+++ b/bocelli/module/base.rb
@@ -1,29 +1,12 @@
+require_relative '../core/router'
+
module Bocelli
module Module
module Base
- attr_reader :routes
+ include Bocelli::Core::Router
def setup
- @routes = {}
- end
-
- def on(route, &block)
- raise 'no block given' if block.nil?
-
- @routes[route] = block
- end
-
- def match?(str, route)
- case route
- when Regexp
- str =~ route
- when String
- str == route
- end
- end
-
- def match(str)
- @routes.detect { |k, _| match?(str, k) }
+ setup_router
end
class << self