GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Rubygem
Fork of nex3/haml
Description: HTML Abstraction Markup Language - A Markup Haiku
Homepage: http://haml.hamptoncatlin.com
Clone URL: git://github.com/chriseppstein/haml.git
Doing template assigns the easier way.


git-svn-id: svn://hamptoncatlin.com/haml/branches/1.5dev@192 
7063305b-7217-0410-af8c-cdc13e5119b9
nex3 (author)
Sun Dec 03 16:33:54 -0800 2006
commit  a6ef2d2e951f22bb23832fe15e78e497e996f4f8
tree    34e1446e90f273ae7c089e77bd4fbb01fd03ca0d
parent  b1ae8dc10279377222bbf9424ebf0ade68ed0b7f
...
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
 
 
63
64
65
...
48
49
50
 
 
 
 
 
 
 
 
 
 
 
 
51
52
53
54
55
0
@@ -48,18 +48,8 @@ module Haml
0
     # with <tt>local_assigns</tt> available as local variables within the template.
0
     # Returns the result as a string.
0
     def render(template, local_assigns={})
0
- unless @view.instance_variable_get("@assigns_added")
0
- assigns = @view.assigns.dup
0
-
0
- # Get inside the view object's world
0
- @view.instance_eval do
0
- # Set all the instance variables
0
- assigns.each do |key,val|
0
- instance_variable_set "@#{key}", val
0
- end
0
- end
0
-
0
- @view.instance_variable_set("@assigns_added", true)
0
+ @view.instance_eval do
0
+ evaluate_assigns
0
       end
0
 
0
       options = @@options.dup
...
16
17
18
19
20
21
 
22
23
24
...
16
17
18
 
 
 
19
20
21
22
0
@@ -16,9 +16,7 @@ class TemplateTest < Test::Unit::TestCase
0
 
0
   def setup
0
     ActionView::Base.register_template_handler("haml", Haml::Template)
0
- @base = ActionView::Base.new(File.dirname(__FILE__) + "/templates/")
0
- @base.instance_variable_set("@article", Article.new)
0
- @base.instance_variable_set("@foo", 'value one')
0
+ @base = ActionView::Base.new(File.dirname(__FILE__) + "/templates/", {'article' => Article.new, 'foo' => 'value one'})
0
   end
0
 
0
   def render(text)

Comments

    No one has commented yet.