disel_router 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/disel_router.rb +29 -0
  3. metadata +45 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cadf0476c76bedaa2d49919f0ed6a3987fc082bc
4
+ data.tar.gz: ef304e2dc63aa2187679be03304356484c34a3cd
5
+ SHA512:
6
+ metadata.gz: 658904e9b540103908894ad42f2b41831bbe2495ae3ae337f846b448e36e87249cd9af33fab9c2a30384a00f7ff1f32a849fc5e8781cb9df6ddb1ca1174d744e
7
+ data.tar.gz: d7d09cd1bcd7c9f76f1f73956008c33822bc21a95e1a1f9d3482b2f2ebbdfd59c3812f523518226246cb87b3e2d0a4ab67f5d904ac1e2a09bd0fa05008d20d39
@@ -0,0 +1,29 @@
1
+ module Disel
2
+ module Router
3
+ ROUTES = Hash.new
4
+
5
+ def self.included(mod)
6
+ mod.module_eval do |m|
7
+
8
+ def m.route(http_method, path, method)
9
+ routes = ROUTES[self]
10
+ if routes.nil?
11
+ ROUTES[self] = Hash.new
12
+ routes = ROUTES[self]
13
+ end
14
+ routes[http_method] = [path, method]
15
+ end
16
+
17
+ def m.included(controller)
18
+ routes = ROUTES[self]
19
+ routes.each do |http_method, arr|
20
+ controller.send(http_method, arr.first) do |*args|
21
+ self.send(arr.last, *args)
22
+ end
23
+ end
24
+ end
25
+
26
+ end
27
+ end
28
+ end
29
+ end
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: disel_router
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Yury Solovyov
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-05-05 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Allows you to define your routes in separate modules and them mix them
14
+ into controllers
15
+ email: biohazard707@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/disel_router.rb
21
+ homepage: http://rubygems.org/gems/disel_router
22
+ licenses:
23
+ - MIT
24
+ metadata: {}
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubyforge_project:
41
+ rubygems_version: 2.4.8
42
+ signing_key:
43
+ specification_version: 4
44
+ summary: Utility mixin for separating your Sinatra routes from controllers
45
+ test_files: []