isaac-malline 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. data/COPYING +674 -0
  2. data/COPYING.LESSER +165 -0
  3. data/History.txt +34 -0
  4. data/Manifest.txt +72 -0
  5. data/README +24 -0
  6. data/README.txt +33 -0
  7. data/Rakefile +74 -0
  8. data/bin/malline +20 -0
  9. data/github.rb +6 -0
  10. data/init.rb +2 -0
  11. data/lib/malline.rb +109 -0
  12. data/lib/malline/adapters/rails-2.0.rb +72 -0
  13. data/lib/malline/adapters/rails-2.1.rb +103 -0
  14. data/lib/malline/erb_out.rb +34 -0
  15. data/lib/malline/form_builder.rb +44 -0
  16. data/lib/malline/plugin.rb +34 -0
  17. data/lib/malline/plugins/xhtml.rb +77 -0
  18. data/lib/malline/rails.rb +46 -0
  19. data/lib/malline/template.rb +185 -0
  20. data/lib/malline/view_proxy.rb +87 -0
  21. data/lib/malline/view_wrapper.rb +95 -0
  22. data/malline.gemspec +34 -0
  23. data/scripts/html2mn.rb +93 -0
  24. data/test/examples/_action.mn +4 -0
  25. data/test/examples/_action.target +1 -0
  26. data/test/examples/_one.mn +1 -0
  27. data/test/examples/_one.target +1 -0
  28. data/test/examples/_partial.mn +2 -0
  29. data/test/examples/_partial.target +1 -0
  30. data/test/examples/_three.rhtml +2 -0
  31. data/test/examples/_two.mn +1 -0
  32. data/test/examples/_two.target +1 -0
  33. data/test/examples/capture.mn +13 -0
  34. data/test/examples/capture.target +1 -0
  35. data/test/examples/class.mn +6 -0
  36. data/test/examples/class.target +1 -0
  37. data/test/examples/escape.mn +4 -0
  38. data/test/examples/escape.target +1 -0
  39. data/test/examples/frontpage.mn +6 -0
  40. data/test/examples/frontpage.target +1 -0
  41. data/test/examples/hello_world.mn +2 -0
  42. data/test/examples/hello_world.target +1 -0
  43. data/test/examples/helper.mn +5 -0
  44. data/test/examples/helper.target +1 -0
  45. data/test/examples/helper2.mn +5 -0
  46. data/test/examples/helper2.target +1 -0
  47. data/test/examples/helper_shortcut.mn +5 -0
  48. data/test/examples/helper_shortcut.target +1 -0
  49. data/test/examples/id.mn +3 -0
  50. data/test/examples/id.target +1 -0
  51. data/test/examples/layout.mn +8 -0
  52. data/test/examples/layout.target +4 -0
  53. data/test/examples/lists.mn +13 -0
  54. data/test/examples/lists.target +1 -0
  55. data/test/examples/nested.mn +6 -0
  56. data/test/examples/nested.target +1 -0
  57. data/test/examples/options.mn +10 -0
  58. data/test/examples/options.target +1 -0
  59. data/test/examples/partials.mn +5 -0
  60. data/test/examples/partials.target +1 -0
  61. data/test/examples/self.mn +2 -0
  62. data/test/examples/self.target +1 -0
  63. data/test/examples/text.mn +4 -0
  64. data/test/examples/text.target +1 -0
  65. data/test/examples/whitespace.mn +9 -0
  66. data/test/examples/whitespace.target +1 -0
  67. data/test/examples/xhtml.mn +11 -0
  68. data/test/examples/xhtml.target +4 -0
  69. data/test/kernel.org.html +107 -0
  70. data/test/kernel.org.mn +657 -0
  71. data/test/malline_test.rb +171 -0
  72. data/test/malline_test_helpers.rb +82 -0
  73. metadata +136 -0
@@ -0,0 +1,165 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
@@ -0,0 +1,34 @@
1
+ = ChangeLog =
2
+
3
+ === [milestone:'Version 1.1.0' Malline 1.1.0] ===
4
+
5
+ Released '''2008-06-06'''
6
+
7
+ * Fix #7, #9: Rails 2.1 support
8
+ * Fix #3: Namespace collisions [42]
9
+ * Much better documentation, see [http://dev.malline.org/rdoc/ RDoc]
10
+ * Refactoring and cleaning the code - #8 separated Rails-specific code
11
+ * New test framework
12
+ * New (still unfinished) plugin interface
13
+
14
+ === [milestone:'Version 1.0.2' Malline 1.0.2] ===
15
+
16
+ Released '''2008-04-01'''
17
+
18
+ Needed a new release for gem packaging.
19
+
20
+ * Fixes #1: Support for gem [38]
21
+
22
+ === [milestone:'Version 1.0.1' Malline 1.0.1] ===
23
+
24
+ Released '''2008-03-31'''
25
+
26
+ * Fixed a bug with Erb layout rendering cached Erb partial after Malline partial. This commit will also fix many weird situations involved with mixing Erb, Malline and Caching or some specific helper methods.
27
+ Thanks to Andrew for reporting the bug. [34]
28
+ * Fixed a inline templating with rails. Fix by Robin. [33]
29
+ * Fixed a problem with Rails 2.0 & erb emulation. Reported and fixed by Gudao Luo. [32]
30
+
31
+ === Malline 1.0 ===
32
+ Released '''2007-10-14'''
33
+
34
+ * First version
@@ -0,0 +1,72 @@
1
+ COPYING
2
+ COPYING.LESSER
3
+ History.txt
4
+ Manifest.txt
5
+ README
6
+ README.txt
7
+ Rakefile
8
+ bin/malline
9
+ github.rb
10
+ init.rb
11
+ lib/malline.rb
12
+ lib/malline/adapters/rails-2.0.rb
13
+ lib/malline/adapters/rails-2.1.rb
14
+ lib/malline/erb_out.rb
15
+ lib/malline/form_builder.rb
16
+ lib/malline/plugin.rb
17
+ lib/malline/plugins/xhtml.rb
18
+ lib/malline/rails.rb
19
+ lib/malline/template.rb
20
+ lib/malline/view_proxy.rb
21
+ lib/malline/view_wrapper.rb
22
+ malline.gemspec
23
+ scripts/html2mn.rb
24
+ test/examples/_action.mn
25
+ test/examples/_action.target
26
+ test/examples/_one.mn
27
+ test/examples/_one.target
28
+ test/examples/_partial.mn
29
+ test/examples/_partial.target
30
+ test/examples/_three.rhtml
31
+ test/examples/_two.mn
32
+ test/examples/_two.target
33
+ test/examples/capture.mn
34
+ test/examples/capture.target
35
+ test/examples/class.mn
36
+ test/examples/class.target
37
+ test/examples/escape.mn
38
+ test/examples/escape.target
39
+ test/examples/frontpage.mn
40
+ test/examples/frontpage.target
41
+ test/examples/hello_world.mn
42
+ test/examples/hello_world.target
43
+ test/examples/helper.mn
44
+ test/examples/helper.target
45
+ test/examples/helper2.mn
46
+ test/examples/helper2.target
47
+ test/examples/helper_shortcut.mn
48
+ test/examples/helper_shortcut.target
49
+ test/examples/id.mn
50
+ test/examples/id.target
51
+ test/examples/layout.mn
52
+ test/examples/layout.target
53
+ test/examples/lists.mn
54
+ test/examples/lists.target
55
+ test/examples/nested.mn
56
+ test/examples/nested.target
57
+ test/examples/options.mn
58
+ test/examples/options.target
59
+ test/examples/partials.mn
60
+ test/examples/partials.target
61
+ test/examples/self.mn
62
+ test/examples/self.target
63
+ test/examples/text.mn
64
+ test/examples/text.target
65
+ test/examples/whitespace.mn
66
+ test/examples/whitespace.target
67
+ test/examples/xhtml.mn
68
+ test/examples/xhtml.target
69
+ test/kernel.org.html
70
+ test/kernel.org.mn
71
+ test/malline_test.rb
72
+ test/malline_test_helpers.rb
data/README ADDED
@@ -0,0 +1,24 @@
1
+ Malline 1.1.0-svn
2
+ =================
3
+
4
+ See documentation on http://www.malline.org/
5
+
6
+ Copyright © 2007,2008 Riku Palomäki, riku@palomaki.fi
7
+ Malline is released under GNU Lesser General Public License.
8
+
9
+
10
+ Example Rails template file images.html.mn:
11
+
12
+ xhtml do
13
+ _render :partial => 'head'
14
+ body do
15
+ div.images! "There are some images:" do
16
+ images.each do |im|
17
+ a(:href => img_path(im)) { img :src => im.url }
18
+ span.caption im.caption
19
+ end
20
+ _"No more images"
21
+ end
22
+ div.footer! { _render :partial => 'footer' }
23
+ end
24
+ end
@@ -0,0 +1,33 @@
1
+ = Malline 1.1.0-svn
2
+
3
+ * http://www.malline.org/
4
+
5
+ == DESCRIPTION:
6
+
7
+ Malline is a full-featured template system designed to be
8
+ a replacement for ERB views in Rails or any other framework.
9
+ It also includes standalone bin/malline to compile Malline
10
+ templates to XML in commandline. All Malline templates are
11
+ pure Ruby, see http://www.malline.org/ for more info.
12
+
13
+ See documentation on http://www.malline.org/
14
+
15
+ Copyright © 2007,2008 Riku Palomäki, riku@palomaki.fi
16
+ Malline is released under GNU Lesser General Public License.
17
+
18
+
19
+ Example Rails template file images.html.mn:
20
+
21
+ xhtml do
22
+ _render :partial => 'head'
23
+ body do
24
+ div.images! "There are some images:" do
25
+ images.each do |im|
26
+ a(:href => img_path(im)) { img :src => im.url }
27
+ span.caption im.caption
28
+ end
29
+ _"No more images"
30
+ end
31
+ div.footer! { _render :partial => 'footer' }
32
+ end
33
+ end
@@ -0,0 +1,74 @@
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rake/rdoctask'
4
+
5
+ desc 'Default: run unit tests.'
6
+ task :default => :test
7
+
8
+ desc 'Test the malline plugin.'
9
+ Rake::TestTask.new(:test) do |t|
10
+ t.libs << 'lib'
11
+ t.pattern = 'test/**/*_test.rb'
12
+ t.verbose = true
13
+ end
14
+
15
+ desc 'Generate documentation for the malline plugin.'
16
+ Rake::RDocTask.new(:rdoc) do |rdoc|
17
+ rdoc.rdoc_dir = 'rdoc'
18
+ rdoc.title = 'Malline'
19
+ rdoc.options += %w[ --line-numbers --inline-source --all
20
+ --charset=UTF-8 --tab-width=2
21
+ --webcvs=http://dev.malline.org/browser/trunk/malline/%s#L1 ]
22
+ rdoc.rdoc_files.include('README')
23
+ rdoc.rdoc_files.include('lib/**/*.rb')
24
+ end
25
+
26
+ summary = <<-EOF
27
+ Malline is a full-featured pure Ruby template system designed to be
28
+ a replacement for ERB views in Rails or any other framework. See
29
+ http://www.malline.org/ for more info.
30
+ EOF
31
+
32
+ desc = <<-EOF
33
+ Malline is a full-featured template system designed to be
34
+ a replacement for ERB views in Rails or any other framework.
35
+ It also includes standalone bin/malline to compile Malline
36
+ templates to XML in commandline. All Malline templates are
37
+ pure Ruby, see http://www.malline.org/ for more info.
38
+ EOF
39
+
40
+ begin
41
+ require 'rubygems'
42
+ require 'rake/gempackagetask'
43
+ PKG_FILES = FileList['lib/**/*.rb', 'bin/*', 'COPYING*', 'README', 'scripts/*rb', 'test/*', 'test/examples/*']
44
+ PKG_VERSION = File.read('README').scan(/^Malline (\d+\.\d+\.\d+)/).first.first
45
+ spec = Gem::Specification.new do |s|
46
+ s.author = 'Riku Palomäki'
47
+ s.email = 'riku@palomaki.fi'
48
+ s.executables = ['malline']
49
+ s.extra_rdoc_files = ['README']
50
+ s.files = PKG_FILES.to_a
51
+ s.homepage = 'http://www.malline.org/'
52
+ s.name = 'malline'
53
+ s.rubyforge_project = 'malline'
54
+ s.summary = summary
55
+ s.test_file = 'test/malline_test.rb'
56
+ s.version = PKG_VERSION
57
+ s.description = desc
58
+ s.has_rdoc = true
59
+ end
60
+
61
+ Rake::GemPackageTask.new(spec) do |pkg|
62
+ pkg.need_zip = true
63
+ pkg.need_tar = true
64
+ end
65
+ rescue LoadError => e
66
+ warn e.message
67
+ warn 'Warning: Package building is disabled because of missing libs'
68
+ end
69
+
70
+ require 'hoe'
71
+
72
+ Hoe.new('malline', '1.1.0') do |p|
73
+ p.developer 'Riku Palomäki', 'riku@palomaki.fi'
74
+ end
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $: << File.join(File.dirname(__FILE__), '..', 'lib')
4
+ require 'malline.rb'
5
+
6
+ nonstrict = ARGV.delete('-ns')
7
+
8
+ input = File.open(ARGV.shift, 'r') rescue $stdin
9
+ output = File.open(ARGV.shift, 'w') rescue $stdout
10
+
11
+ if File.exists?('malline_helper.rb')
12
+ require 'malline_helper.rb'
13
+ view = MallineHelper.new
14
+ else
15
+ view = nil
16
+ end
17
+
18
+ mn = Malline::Base.new(view, :strict => (nonstrict ? false : true))
19
+
20
+ output.puts mn.render(input.read)
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby -wKU
2
+ require 'rubygems/specification'
3
+ data = File.read('malline.gemspec')
4
+ spec = nil
5
+ Thread.new { spec = eval("$SAFE = 3\n#{data}") }.join
6
+ puts spec
data/init.rb ADDED
@@ -0,0 +1,2 @@
1
+ # This file is required by Rails if using a Malline plugin
2
+ require 'malline/rails'
@@ -0,0 +1,109 @@
1
+ # Copyright © 2007,2008 Riku Palomäki
2
+ #
3
+ # This file is part of Malline.
4
+ #
5
+ # Malline is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU Lesser General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or
8
+ # (at your option) any later version.
9
+ #
10
+ # Malline is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU Lesser General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public License
16
+ # along with Malline. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ require 'malline/view_proxy.rb'
19
+ require 'malline/view_wrapper.rb'
20
+ require 'malline/erb_out.rb'
21
+ require 'malline/template.rb'
22
+ require 'malline/plugin.rb'
23
+ require 'malline/plugins/xhtml.rb'
24
+
25
+ module Malline
26
+ # Always form ^\d+\.\d+\.\d+(-[^\s]*)?$
27
+ VERSION = '1.1.0-svn'
28
+
29
+ # Malline handler, always use Malline engine with this
30
+ # handler = Malline.new @view, :strict => false
31
+ # handler.
32
+ class Base
33
+ attr_accessor :malline
34
+
35
+ # Default options, can be changed with setopt
36
+ @@options = {
37
+ :strict => true,
38
+ :xhtml => true,
39
+ :encoding => 'UTF-8',
40
+ :lang => 'en',
41
+ :form_for_proxy => true
42
+ }
43
+
44
+ # First parameter is the view object (if any)
45
+ # Last parameter is optional options hash
46
+ def initialize *opts
47
+ @options = @@options.dup
48
+ @options.merge! opts.pop if opts.last.is_a?(Hash)
49
+
50
+ @view = opts.shift || Class.new
51
+ @view.extend ViewWrapper unless @view.is_a?(ViewWrapper)
52
+ @malline = @view.malline @options
53
+ end
54
+
55
+ # Get the current filename
56
+ def path
57
+ @view.malline.path
58
+ end
59
+
60
+ def path= npath
61
+ @view.malline.path = npath
62
+ end
63
+
64
+ # for example:
65
+ # setopt :strict => false
66
+ #
67
+ # or:
68
+ # setopt :strict => false
69
+ # something
70
+ # setopt :strict => true do
71
+ # something strict
72
+ # end
73
+ def self.setopt hash
74
+ return @@options.merge!(hash) unless block_given?
75
+ old = @@options.dup
76
+ @@options.merge! hash if hash
77
+ yield
78
+ ensure
79
+ @@options = old if old
80
+ end
81
+
82
+ def render tpl = nil, local_assigns = {}, &block
83
+ add_local_assigns local_assigns
84
+ @view.malline.run tpl, &block
85
+ end
86
+
87
+ def self.render tpl = nil, local_assigns = {}, &block
88
+ self.new.render tpl, local_assigns, &block
89
+ end
90
+
91
+ def definetags *args
92
+ @view.malline.definetags *args
93
+ end
94
+
95
+ def definetags! *args
96
+ @view.malline.definetags! *args
97
+ end
98
+
99
+ private
100
+ # Define hash as instance variables, for example { :foo => 'bar' }
101
+ # will work as @foo == 'bar' and foo == 'bar'
102
+ def add_local_assigns l
103
+ @view.instance_eval do
104
+ l.each { |key, value| instance_variable_set "@#{key}", value }
105
+ class << self; self; end.send(:attr_accessor, *(l.keys))
106
+ end
107
+ end
108
+ end
109
+ end