merb-core 1.0.7 → 1.0.7.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -412,31 +412,35 @@ module Merb::RenderMixin
412
412
  #
413
413
  # :api: private
414
414
  def _template_for(context, content_type, controller=nil, template=nil, locals=[])
415
- self.class._templates_for[[context, content_type, controller, template, locals]] ||= begin
416
-
417
- template_method, template_location = nil, nil
415
+ tmp = self.class._templates_for[[context, content_type, controller, template, locals]]
416
+ return tmp if tmp
418
417
 
419
- # absolute path to a template (:template => "/foo/bar")
420
- if template.is_a?(String) && template =~ %r{^/}
421
- template_location = self._absolute_template_location(template, content_type)
422
- return [_template_method_for(template_location, locals), template_location]
423
- end
418
+ template_method, template_location = nil, nil
419
+
420
+ # absolute path to a template (:template => "/foo/bar")
421
+ if template.is_a?(String) && template =~ %r{^/}
422
+ template_location = self._absolute_template_location(template, content_type)
423
+ return [_template_method_for(template_location, locals), template_location]
424
+ end
424
425
 
425
- self.class._template_roots.reverse_each do |root, template_meth|
426
- # :template => "foo/bar.html" where root / "foo/bar.html.*" exists
427
- if template
428
- template_location = root / self.send(template_meth, template, content_type, nil)
429
- # :layout => "foo" where root / "layouts" / "#{controller}.html.*" exists
430
- else
431
- template_location = root / self.send(template_meth, context, content_type, controller)
432
- end
433
-
434
- break if template_method = _template_method_for(template_location.to_s, locals)
426
+ self.class._template_roots.reverse_each do |root, template_meth|
427
+ # :template => "foo/bar.html" where root / "foo/bar.html.*" exists
428
+ if template
429
+ template_location = root / self.send(template_meth, template, content_type, nil)
430
+ # :layout => "foo" where root / "layouts" / "#{controller}.html.*" exists
431
+ else
432
+ template_location = root / self.send(template_meth, context, content_type, controller)
435
433
  end
434
+
435
+ break if template_method = _template_method_for(template_location.to_s, locals)
436
+ end
436
437
 
437
- # template_location is a Pathname
438
- [template_method, template_location.to_s]
438
+ # template_location is a Pathname
439
+ ret = [template_method, template_location.to_s]
440
+ unless Merb::Config[:reload_templates]
441
+ self.class._templates_for[[context, content_type, controller, template, locals]] = ret
439
442
  end
443
+ ret
440
444
  end
441
445
 
442
446
  # Return the template method for a location, and check to make sure the current controller
@@ -1,4 +1,4 @@
1
1
  module Merb
2
- VERSION = '1.0.7' unless defined?(Merb::VERSION)
2
+ VERSION = '1.0.7.1' unless defined?(Merb::VERSION)
3
3
  DM_VERSION = '0.9.8' unless defined?(Merb::DM_VERSION)
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: merb-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ezra Zygmuntowicz
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-12-28 00:00:00 -08:00
12
+ date: 2008-12-31 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency