halfling 0.0.10 → 0.0.12

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
- SHA1:
3
- metadata.gz: 9047695f3092b0f51b109315003f5147bded1972
4
- data.tar.gz: 85edf877936c2bb6cc4b3524ebd2e5a8c97b39a7
2
+ SHA256:
3
+ metadata.gz: bb2a8cc5cac3f1e57d3cd7f837462060165059730803da6a311f5b7d914286f2
4
+ data.tar.gz: f5610e1f0d2f5fcb102d1eb33847e9203c494ebfc301157ef330a6a180006169
5
5
  SHA512:
6
- metadata.gz: 2b02ae742ccc5ac8f9ff3eca8d7bac57af7a48abe2628b61a99d41954661ee873a00616cf6014db0735b7c9847dcad04a332f61f16ba32468e9731d61cc5b459
7
- data.tar.gz: 4e2474dda72c3ce476dda606c566b4c268dcdaa4b02b5aeaefcf6c84dc7b51697e1b8726e6a1e66dda47f9929da8023fd15ec887b64cfd3cd132e571d54f3ed5
6
+ metadata.gz: d08cf5e8c4ba7db1e278e7989fe379db4aa7ca8de00519a7ba95fa82ef925fc09da2e0a78fe0aa8704842af1d8b60f0c8e2d84cf249ccda41b3553fed7f1bbdd
7
+ data.tar.gz: 4a0ccb2f66ab84f557ec604d8c053462438b53d77a77956396d3915de27a0d2b149ec39d8ea36c551446584745c7c1ec2345bd35c8f7b36f1c1eb4ff0181eb2a
data/lib/halfling/base.rb CHANGED
@@ -18,8 +18,8 @@ module Hobbit
18
18
  def inherited(sub)
19
19
  if sub.superclass == Base
20
20
  #config stuff
21
- if File.exists?('config/env.yml')
22
- all_conf=YAML.load_file 'config/env.yml'
21
+ if File.exist?('config/env.yml')
22
+ all_conf=YAML.unsafe_load_file 'config/env.yml'
23
23
  conf=all_conf[ENV['RACK_ENV']]
24
24
  @@templates={}
25
25
  @@config=conf
@@ -111,22 +111,34 @@ module Hobbit
111
111
  end
112
112
  @@root_controller = nil
113
113
  end
114
+ @render_nesting_level = 0
114
115
  super
115
116
  end
116
117
 
117
118
  #template stuff
118
119
  def find_template(template)
119
120
  tmpl_path=@@templates[template.to_sym]
120
- raise "template #{template} not found" unless tmpl_path
121
+ raise "template \"#{template}\" not found" unless tmpl_path
121
122
  tmpl_path
122
123
  end
123
124
  def default_layout
124
- find_template :"layouts/application"
125
+ if @render_nesting_level <= 1
126
+ find_template :"layouts/application"
127
+ else
128
+ #with nested rendering, default layout is nil.
129
+ nil
130
+ end
125
131
  end
126
132
  def template_engine
127
133
  raise "template_engine shouldn't be called"
128
134
  end
129
-
135
+
136
+ def render(*args)
137
+ @render_nesting_level += 1
138
+ ret = super
139
+ @render_nesting_level -= 1
140
+ ret
141
+ end
130
142
 
131
143
  #convenience stuff
132
144
  def set_content_type (val)
@@ -1,3 +1,3 @@
1
1
  module Halfling
2
- VERSION = '0.0.10'
2
+ VERSION = '0.0.12'
3
3
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: halfling
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leo P.
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2017-01-24 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: hobbit
@@ -171,7 +170,6 @@ licenses:
171
170
  - MIT
172
171
  metadata:
173
172
  allowed_push_host: https://rubygems.org
174
- post_install_message:
175
173
  rdoc_options: []
176
174
  require_paths:
177
175
  - lib
@@ -186,9 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
186
184
  - !ruby/object:Gem::Version
187
185
  version: '0'
188
186
  requirements: []
189
- rubyforge_project:
190
- rubygems_version: 2.6.8
191
- signing_key:
187
+ rubygems_version: 3.6.9
192
188
  specification_version: 4
193
189
  summary: Halfling - a Hobbit with some Railsy structure
194
190
  test_files: []