summaryrefslogtreecommitdiff
path: root/bocelli/module/base.rb
blob: 1306830de6a4648bf54c00effb6fcd99f5f22641 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
module Bocelli
  module Module
    module Base
      attr_reader :routes

      def setup
        @routes = {}
      end

      def on(route, &block)
        raise 'no block given' if block.nil?

        @routes[route] = block
      end

      class << self
        def extended(mod)
          super

          mod.setup
        end
      end
    end
  end
end