jetra 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5b6d7a10300cb071943c84db41627c7dbc051e4c
4
- data.tar.gz: f4c8b2ce7efaa9d93ccbe301eb70ee51b44b155f
3
+ metadata.gz: 4d2a37d746863b2076fd043a0561b673caea40e3
4
+ data.tar.gz: 8a0fb45d82a95c46ed9f24173625bb817d3a3c94
5
5
  SHA512:
6
- metadata.gz: 000a5c59fc536a6d0f95ffef0c50bee342da2843da07f2cc288f9c1d7245eb6fe0ee40712f96ccfdf8b7abe1e1d7036705c6f70fc210aaf7311fd6eb907555f6
7
- data.tar.gz: d7c93df3cba8b1f6e734c01f6499c50457a02a4b2dbd1c87330fc6cb2585bb7d97fc618ede00926b1c62ad4f061cd19a13c8510f3421859c43e330da2825ab7b
6
+ metadata.gz: 3c106b9c11254e4d03c24a6425b06fd9755874c7cad4076b018845427f22ca1c52d3ccf75fb43499d6c92502214415bbea9653021f64ec4755159702378ce116
7
+ data.tar.gz: b38d6d356c2cc54d2fe1370a34bff21e1ea887ca10cbc5b253a4ea92db933fe25a012df616d91a0e3e9181d917d8594cefe67fa25b3ded4050cf4d6786387828
@@ -8,7 +8,7 @@ module Jetra
8
8
 
9
9
  include Rack::Utils
10
10
 
11
- def initialize(app)
11
+ def initialize(app, &custom_block)
12
12
  @app = app
13
13
 
14
14
  @routes = Set.new
@@ -16,6 +16,8 @@ module Jetra
16
16
  @routes << route
17
17
  end
18
18
 
19
+ @custom_block = custom_block
20
+
19
21
  end
20
22
 
21
23
  def call(env)
@@ -28,11 +30,17 @@ module Jetra
28
30
 
29
31
  sym_route = route.to_sym
30
32
 
33
+ params = indifferent_params(request.params)
34
+
35
+ if @custom_block
36
+ @custom_block.call(request, params)
37
+ end
38
+
31
39
  if @routes.include?(sym_route)
32
- params = indifferent_params(request.params)
33
40
  res = @app.call(sym_route, params)
34
41
  else
35
- res = @app.call(:not_found, {route: route})
42
+ params[:route] = route
43
+ res = @app.call(:not_found, params)
36
44
  end
37
45
 
38
46
  result = {}
data/lib/jetra/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Jetra
2
2
 
3
- Version = "1.0.1"
3
+ Version = "1.0.2"
4
4
 
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jetra
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeffrey
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-20 00:00:00.000000000 Z
11
+ date: 2017-04-25 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: micro DSL
14
14
  email: