rack-app-front_end 0.6.0 → 0.7.0

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: 8a98853e4d1d6ba49e9ed62fac3721dc0dc69303
4
- data.tar.gz: 89f90e9bbdee9d46c78a37361162ce7c2ed1efeb
3
+ metadata.gz: f718edbb7664cd7d31292207b4280209c6d4317b
4
+ data.tar.gz: 65a3eb447ada7f415c42d4cc0982c080ef92a439
5
5
  SHA512:
6
- metadata.gz: 5350fee85341ee409fb3eb249714b297b4121b01dea778ea837045730f769c2666421b5c7d9d8ac2c4791a639ebf9362231eb613c8d123e064163f7e1b03572c
7
- data.tar.gz: a860de2ad2cbfa5ac3a4950deb2969f6f9ca16a4b80eba4d212edb44746254942f930c0ee07f6851dde4433cadabdf928745d1fedc47881fd5d8c4a9838a73cb
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.6.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 { Tilt.new(@file_path).render(*args, &block) }
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] ? Tilt.new(@options[:layout]) : DefaultLayout
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.6.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-25 00:00:00.000000000 Z
11
+ date: 2016-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler