rack-app-front_end 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/VERSION +1 -1
- data/lib/rack/app/front_end/template.rb +14 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f718edbb7664cd7d31292207b4280209c6d4317b
|
4
|
+
data.tar.gz: 65a3eb447ada7f415c42d4cc0982c080ef92a439
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c747e405598e2f5858028e443b27a339806bfc0cec38a6b7123be8276c2f74e190e15bc1e41db885bb3d7762b11410901232ea7d7a1478304cd9363874d08d36
|
7
|
+
data.tar.gz: b9f4d8eeee2af4e4f57a551ce73cd3ed3c86386a0fb6f201f1b978be422bffe2cd103beeb11b5ed4dec21694f4bfe80a5295d6a16551093803d382414962b331
|
data/README.md
CHANGED
@@ -27,8 +27,8 @@ class App < Rack::App
|
|
27
27
|
extend Rack::App::FrontEnd
|
28
28
|
|
29
29
|
mount_folder '/from/project/root/path'
|
30
|
-
mount_folder 'relative/folder/from/this/file/to/folder'
|
31
30
|
|
31
|
+
mount_folder 'relative/folder/from/this/file/to/folder'
|
32
32
|
|
33
33
|
get '/some_url' do
|
34
34
|
@items = []
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.7.0
|
@@ -3,6 +3,10 @@ class Rack::App::FrontEnd::Template
|
|
3
3
|
|
4
4
|
require 'rack/app/front_end/template/default_layout'
|
5
5
|
|
6
|
+
def self.cache
|
7
|
+
@cache ||= Tilt::Cache.new
|
8
|
+
end
|
9
|
+
|
6
10
|
def render(*args, &block)
|
7
11
|
return render_result(*args, &block)
|
8
12
|
end
|
@@ -17,15 +21,23 @@ class Rack::App::FrontEnd::Template
|
|
17
21
|
def render_result(*args, &block)
|
18
22
|
return Rack::App::File::Streamer.new(@file_path) unless it_is_a_template?
|
19
23
|
|
20
|
-
layout.render {
|
24
|
+
layout.render { template.render(*args, &block) }
|
21
25
|
end
|
22
26
|
|
23
27
|
def it_is_a_template?
|
24
28
|
not Tilt.templates_for(@file_path).empty?
|
25
29
|
end
|
26
30
|
|
31
|
+
def template
|
32
|
+
get_template(@file_path)
|
33
|
+
end
|
34
|
+
|
27
35
|
def layout
|
28
|
-
@options[:layout] ?
|
36
|
+
@options[:layout] ? get_template(@options[:layout]) : DefaultLayout
|
37
|
+
end
|
38
|
+
|
39
|
+
def get_template(file_path)
|
40
|
+
self.class.cache.fetch(file_path) { Tilt.new(file_path) }
|
29
41
|
end
|
30
42
|
|
31
43
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-app-front_end
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Luzsi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|