rack-app 1.1.0 → 1.2.1
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 +4 -4
- data/VERSION +1 -1
- data/lib/rack/app.rb +14 -3
- data/lib/rack/app/utils.rb +5 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4eef3953a3332ea814c75249e84d9d496659749e
|
4
|
+
data.tar.gz: 6f084a0cdd793f5daffc8c7af117317cc3afbe6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d250a0e12315ed15bbba94ed26d6c7a77b1a13f434e738035598876b026526b2b4aea8a932489bba1b6884b44250591fadff9cd80476eb669153e4df7a75e3de
|
7
|
+
data.tar.gz: bbbca7aaacdc2b0aaac3af529b097f1311a548ed877b577f55a9798f8454abe408c6a63cfb8765b2bed5df7e4f78a13253b778a1e0bee7a8dd7321bbb4492c4c
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1
|
1
|
+
1.2.1
|
data/lib/rack/app.rb
CHANGED
@@ -22,14 +22,25 @@ class Rack::App
|
|
22
22
|
|
23
23
|
def inherited(klass)
|
24
24
|
|
25
|
+
klass.serializer(&serializer.logic)
|
26
|
+
klass.headers.merge!(headers)
|
27
|
+
klass.middlewares.push(*middlewares)
|
28
|
+
|
29
|
+
on_inheritance.each do |block|
|
30
|
+
block.call(self, klass)
|
31
|
+
klass.on_inheritance(&block)
|
32
|
+
end
|
33
|
+
|
25
34
|
error.handlers.each do |ex_class, block|
|
26
35
|
klass.error(ex_class, &block)
|
27
36
|
end
|
28
37
|
|
29
|
-
|
30
|
-
middlewares.each { |builder_block| klass.middlewares(&builder_block) }
|
31
|
-
klass.headers.merge!(headers)
|
38
|
+
end
|
32
39
|
|
40
|
+
def on_inheritance(&block)
|
41
|
+
@on_inheritance ||= []
|
42
|
+
@on_inheritance << block unless block.nil?
|
43
|
+
@on_inheritance
|
33
44
|
end
|
34
45
|
|
35
46
|
def serializer(&definition_how_to_serialize)
|
data/lib/rack/app/utils.rb
CHANGED
@@ -57,15 +57,17 @@ module Rack::App::Utils
|
|
57
57
|
case file_path
|
58
58
|
|
59
59
|
when /^\.\//
|
60
|
-
File.expand_path(File.join(File.dirname(caller[1]),file_path))
|
60
|
+
File.expand_path(File.join(File.dirname(caller[1]), file_path))
|
61
61
|
|
62
62
|
when /^[^\/]/
|
63
|
-
File.join(caller[1].split(/\.(?:rb|ru)/)[0],file_path)
|
63
|
+
File.join(caller[1].split(/\.(?:rb|ru)/)[0], file_path)
|
64
64
|
|
65
65
|
when /^\//
|
66
|
-
pwd(file_path)
|
66
|
+
from_project_root_path = pwd(file_path)
|
67
|
+
File.exist?(from_project_root_path) ? from_project_root_path : file_path
|
67
68
|
|
68
69
|
end
|
70
|
+
|
69
71
|
end
|
70
72
|
|
71
73
|
end
|