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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1f0212581c0302e96e3c57653717c120176b4ba5
4
- data.tar.gz: f9b8d8261cd14ebe2ca18a16d5911005a87f7fd4
3
+ metadata.gz: 4eef3953a3332ea814c75249e84d9d496659749e
4
+ data.tar.gz: 6f084a0cdd793f5daffc8c7af117317cc3afbe6a
5
5
  SHA512:
6
- metadata.gz: 82ccad0eb43f24cfa18bf39989d91e86fca8e80e6706c76858d4163a5eb7a3274256752cd50910a83d71c8029f2e9f47d0eedb28824a011951b7f726ac8c9a65
7
- data.tar.gz: 16670b0e9bb15820d5d82d3fc62534f839aeb69aef532b489226786f8b72016ea0a23473af90d012c5deda569ac42d8e38af6b5d551bc6a743f29d37e0b046da
6
+ metadata.gz: d250a0e12315ed15bbba94ed26d6c7a77b1a13f434e738035598876b026526b2b4aea8a932489bba1b6884b44250591fadff9cd80476eb669153e4df7a75e3de
7
+ data.tar.gz: bbbca7aaacdc2b0aaac3af529b097f1311a548ed877b577f55a9798f8454abe408c6a63cfb8765b2bed5df7e4f78a13253b778a1e0bee7a8dd7321bbb4492c4c
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 1.2.1
@@ -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
- klass.serializer(&serializer.logic)
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)
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-app
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Luzsi