view_models 1.5.7 → 2.0.0.ruby19

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.
Files changed (97) hide show
  1. data/lib/init.rb +1 -0
  2. data/lib/padrino/README.textile +3 -0
  3. data/lib/padrino/init.rb +10 -0
  4. data/lib/padrino/lib/helpers/collection.rb +27 -0
  5. data/lib/padrino/lib/padrino/view_models.rb +19 -0
  6. data/lib/padrino/lib/view_models/base.rb +65 -0
  7. data/lib/rails2/README.textile +3 -0
  8. data/{TODO.textile → lib/rails2/TODO.textile} +0 -0
  9. data/{generators → lib/rails2/generators}/view_models/USAGE +0 -0
  10. data/{generators → lib/rails2/generators}/view_models/templates/README +0 -0
  11. data/{generators → lib/rails2/generators}/view_models/templates/spec/view_model_spec.rb +0 -0
  12. data/{generators → lib/rails2/generators}/view_models/templates/view_models/view_model.rb +0 -0
  13. data/{generators → lib/rails2/generators}/view_models/templates/views/_empty.html.haml +0 -0
  14. data/{generators → lib/rails2/generators}/view_models/templates/views/view_models/collection/_collection.html.erb +0 -0
  15. data/{generators → lib/rails2/generators}/view_models/templates/views/view_models/collection/_collection.html.haml +0 -0
  16. data/{generators → lib/rails2/generators}/view_models/templates/views/view_models/collection/_collection.text.erb +0 -0
  17. data/{generators → lib/rails2/generators}/view_models/templates/views/view_models/collection/_list.html.erb +0 -0
  18. data/{generators → lib/rails2/generators}/view_models/templates/views/view_models/collection/_list.text.erb +0 -0
  19. data/{generators → lib/rails2/generators}/view_models/templates/views/view_models/collection/_pagination.html.haml +0 -0
  20. data/{generators → lib/rails2/generators}/view_models/templates/views/view_models/collection/_pagination.text.erb +0 -0
  21. data/{generators → lib/rails2/generators}/view_models/templates/views/view_models/collection/_table.html.haml +0 -0
  22. data/{generators → lib/rails2/generators}/view_models/templates/views/view_models/collection/_table.text.erb +0 -0
  23. data/{generators → lib/rails2/generators}/view_models/view_models_generator.rb +0 -0
  24. data/lib/rails2/init.rb +18 -0
  25. data/lib/{experimental → rails2/lib/experimental}/modules_in_render_hierarchy.rb +0 -0
  26. data/lib/{extensions → rails2/lib/extensions}/view.rb +0 -0
  27. data/lib/rails2/lib/helpers/collection.rb +27 -0
  28. data/lib/{helpers → rails2/lib/helpers}/view.rb +0 -0
  29. data/lib/rails2/lib/view_models.rb +1 -0
  30. data/lib/rails2/lib/view_models/base.rb +99 -0
  31. data/lib/{view_models → rails2/lib/view_models}/view.rb +5 -1
  32. data/lib/shared/README.textile +3 -0
  33. data/lib/shared/init.rb +11 -0
  34. data/lib/shared/lib/view_models.rb +4 -0
  35. data/lib/{view_models → shared/lib/view_models}/base.rb +46 -91
  36. data/lib/{view_models/controller_extractor.rb → shared/lib/view_models/context_extractor.rb} +4 -2
  37. data/lib/{extensions → shared/lib/view_models/extensions}/active_record.rb +2 -0
  38. data/lib/{extensions → shared/lib/view_models/extensions}/model_reader.rb +1 -1
  39. data/lib/{helpers → shared/lib/view_models/helpers}/collection.rb +1 -13
  40. data/lib/{helpers/rails.rb → shared/lib/view_models/helpers/mapping.rb} +5 -1
  41. data/lib/{view_models → shared/lib/view_models}/path_store.rb +0 -0
  42. data/lib/{view_models → shared/lib/view_models}/render_options.rb +4 -0
  43. data/lib/view_models.rb +5 -3
  44. metadata +60 -109
  45. data/CHANGELOG +0 -26
  46. data/MIT-LICENSE +0 -20
  47. data/README.textile +0 -40
  48. data/Rakefile +0 -49
  49. data/VERSION.yml +0 -4
  50. data/generators/view_models/templates/views/view_models/collection/_list.html.haml +0 -7
  51. data/lib/experimental/README.textile +0 -32
  52. data/rails/init.rb +0 -18
  53. data/spec/integration/integration_spec.rb +0 -281
  54. data/spec/integration/models/sub_subclass.rb +0 -14
  55. data/spec/integration/models/subclass.rb +0 -3
  56. data/spec/integration/view_models/module_for_rendering.rb +0 -7
  57. data/spec/integration/view_models/project.rb +0 -14
  58. data/spec/integration/view_models/sub_subclass.rb +0 -42
  59. data/spec/integration/view_models/subclass.rb +0 -1
  60. data/spec/integration/views/view_models/collection/_collection.html.erb +0 -1
  61. data/spec/integration/views/view_models/collection/_collection.text.erb +0 -6
  62. data/spec/integration/views/view_models/collection/_list.html.erb +0 -1
  63. data/spec/integration/views/view_models/collection/_list.text.erb +0 -6
  64. data/spec/integration/views/view_models/module_for_rendering/_not_found_in_sub_subclass_but_in_module.erb +0 -1
  65. data/spec/integration/views/view_models/sub_subclass/_capture_in_template.erb +0 -2
  66. data/spec/integration/views/view_models/sub_subclass/_capture_in_view_model.erb +0 -3
  67. data/spec/integration/views/view_models/sub_subclass/_collection_example.html.erb +0 -3
  68. data/spec/integration/views/view_models/sub_subclass/_collection_example.text.erb +0 -3
  69. data/spec/integration/views/view_models/sub_subclass/_collection_item.html.erb +0 -1
  70. data/spec/integration/views/view_models/sub_subclass/_collection_item.text.erb +0 -1
  71. data/spec/integration/views/view_models/sub_subclass/_exists.erb +0 -1
  72. data/spec/integration/views/view_models/sub_subclass/_exists.html.erb +0 -1
  73. data/spec/integration/views/view_models/sub_subclass/_exists.text.erb +0 -1
  74. data/spec/integration/views/view_models/sub_subclass/_exists_in_both.erb +0 -1
  75. data/spec/integration/views/view_models/sub_subclass/_inner.also_explicit.erb +0 -1
  76. data/spec/integration/views/view_models/sub_subclass/_inner.nesting.erb +0 -1
  77. data/spec/integration/views/view_models/sub_subclass/_list_example.html.erb +0 -3
  78. data/spec/integration/views/view_models/sub_subclass/_list_example.text.erb +0 -3
  79. data/spec/integration/views/view_models/sub_subclass/_list_item.html.erb +0 -1
  80. data/spec/integration/views/view_models/sub_subclass/_list_item.text.erb +0 -1
  81. data/spec/integration/views/view_models/sub_subclass/_outer.explicit.erb +0 -1
  82. data/spec/integration/views/view_models/sub_subclass/_outer.nesting.erb +0 -1
  83. data/spec/integration/views/view_models/sub_subclass/_part_that_is_dependent_on_the_view_model.erb +0 -1
  84. data/spec/integration/views/view_models/sub_subclass/show.html.erb +0 -1
  85. data/spec/integration/views/view_models/sub_subclass/show.text.erb +0 -1
  86. data/spec/integration/views/view_models/subclass/_exists_in_both.erb +0 -1
  87. data/spec/integration/views/view_models/subclass/_no_sub_subclass.erb +0 -1
  88. data/spec/integration/views/view_models/subclass/_not_found_in_sub_subclass.erb +0 -1
  89. data/spec/lib/extensions/active_record_spec.rb +0 -31
  90. data/spec/lib/extensions/model_reader_spec.rb +0 -93
  91. data/spec/lib/helpers/collection_spec.rb +0 -196
  92. data/spec/lib/helpers/rails_spec.rb +0 -84
  93. data/spec/lib/helpers/view_spec.rb +0 -20
  94. data/spec/lib/view_models/base_spec.rb +0 -102
  95. data/spec/lib/view_models/view_spec.rb +0 -9
  96. data/spec/spec_helper.rb +0 -14
  97. data/spec/spec_helper_extensions.rb +0 -13
data/VERSION.yml DELETED
@@ -1,4 +0,0 @@
1
- ---
2
- :minor: 5
3
- :patch: 7
4
- :major: 1
@@ -1,7 +0,0 @@
1
- %ol.collection
2
- - collection.each do |item|
3
- - view_model = view_model_for item
4
- %li
5
- - options = (template_format ? { :format => template_format } : {})
6
- = view_model.render_as template_name, options
7
- = separator unless item == collection.last
@@ -1,32 +0,0 @@
1
- h1. module ModulesInRenderHierarchy
2
-
3
- Why would we need that?
4
-
5
- h2. Situation
6
-
7
- We have a music platform. There we have public profiles, and private profiles. And of each type a band, and a venue profile.
8
-
9
- Public / Private have different functionality, and also Band / Venue.
10
-
11
- The chose class structure looks like this:
12
-
13
- @Public::Base < Project@, @Private::Base < Project@
14
- @Public::Band < Public::Base@, @Public::Venue < Public::Base@, @Private::Band < Private::Base@, @Private::Venue < Private::Base@
15
-
16
- To not have duplicate code, we include the functionality for Bands and Venues by using @include BandFunctionality@ and @include VenueFunctionality@.
17
-
18
- h2. Problem
19
-
20
- When rendering using the hierarchical rendering, we look up the templates as follows:
21
-
22
- (For ViewModels::Public::Band#render_as :example, :format => :html)
23
- # @views/view_models/public/band/_example.html.erb@
24
- # @views/view_models/public/base/_example.html.erb@
25
- # @views/view_models/project/_example.html.erb@
26
-
27
- So the example template is taken from the @public/band@ directory. Why not from a @functionality/band@ directory (assuming the module is named @Functionality::Band@). The reason for this is that the current (v1.5.4) hierarchical rendering process uses superclass, which hops over Modules, rather than using ancestors, which wouldn't.
28
-
29
- h2. Solution
30
-
31
- #. Either override superclass, with all associated problems
32
- #. Or refit the whole hierarchical rendering into a HierarchicalRendering Class. (Preferred)
data/rails/init.rb DELETED
@@ -1,18 +0,0 @@
1
- # require 'experimental/modules_in_render_hierarchy'
2
-
3
- require 'extensions/active_record'
4
- require 'extensions/model_reader'
5
-
6
- require 'view_models'
7
- require 'view_models/render_options'
8
- require 'view_models/controller_extractor'
9
- require 'view_models/path_store'
10
- require 'view_models/base'
11
- require 'view_models/view'
12
-
13
- require 'helpers/view'
14
- require 'helpers/rails'
15
- require 'helpers/collection'
16
-
17
- ActionController::Base.send :include, ViewModels::Helpers::Rails
18
- ActionView::Base.send :include, ViewModels::Helpers::Rails
@@ -1,281 +0,0 @@
1
- require File.join(File.dirname(__FILE__), '../spec_helper')
2
-
3
- # require File.join(File.dirname(__FILE__), '../../lib/experimental/modules_in_render_hierarchy')
4
-
5
- require File.join(File.dirname(__FILE__), 'models/subclass')
6
- require File.join(File.dirname(__FILE__), 'models/sub_subclass')
7
-
8
- require 'helpers/rails'
9
- ActionView::Base.send :include, ViewModels::Helpers::Rails
10
-
11
- require 'view_models/base'
12
- require File.join(File.dirname(__FILE__), 'view_models/project')
13
- require File.join(File.dirname(__FILE__), 'view_models/subclass')
14
- require File.join(File.dirname(__FILE__), 'view_models/sub_subclass')
15
- require File.join(File.dirname(__FILE__), 'view_models/module_for_rendering')
16
-
17
- require 'action_controller'
18
- require 'action_controller/test_process'
19
-
20
- class TestController < ActionController::Base; end
21
-
22
- describe 'Integration' do
23
-
24
- before(:each) do
25
- begin
26
- @controller = TestController.new
27
- @controller.class.view_paths = ['spec/integration/views']
28
-
29
- @logger = stub :logger, :null_object => true
30
- @controller.logger = @logger
31
-
32
- @request = ActionController::TestRequest.new
33
- @response = ActionController::TestResponse.new
34
- @controller.request = @request
35
- @controller.response = @response
36
-
37
- # TODO Make separate contexts, one where the controller has rendered, one where it has not.
38
- #
39
- # Let the Controller generate a view instance.
40
- #
41
- # @controller.process @request, @response
42
-
43
- @view = ActionView::Base.new @controller.class.view_paths, {}, @controller
44
- @model = SubSubclass.new
45
- @model.id = :some_id
46
- @view_model = ViewModels::SubSubclass.new @model, @view
47
- end
48
- end
49
-
50
- before(:all) { puts "\n#{self.send(:description_args)[0]}:" }
51
-
52
- # context 'experimental inclusion of module in render hierarchy' do
53
- # before(:each) do
54
- # ViewModels::Base.send :include, ModulesInRenderHierarchy
55
- # @view_model.class.send :include, ModuleForRendering
56
- # end
57
- # describe 'render_as' do
58
- # it 'should description' do
59
- # @view_model.render_as(:not_found_in_sub_subclass_but_in_module).should == '_not_found_in_sub_subclass_but_in_module.erb'
60
- # end
61
- # end
62
- # end
63
-
64
- describe 'ActiveRecord Extensions' do
65
- before(:each) do
66
- @view_model.extend ViewModels::Extensions::ActiveRecord
67
- end
68
- it 'should delegate the id' do
69
- @view_model.id.should == :some_id
70
- end
71
- it 'should delegate the id' do
72
- @view_model.dom_id.should == 'sub_subclass_some_id'
73
- end
74
- end
75
-
76
- describe 'view_model_for' do
77
- context 'view model' do
78
- it 'should be available' do
79
- lambda { @view_model.view_model_for @model }.should_not raise_error
80
- end
81
- it 'should return the right one' do
82
- @view_model.view_model_for(@model).should be_kind_of(ViewModels::SubSubclass)
83
- end
84
- end
85
- end
86
- describe 'view_model_class_for' do
87
- context 'view model' do
88
- it 'should be available' do
89
- lambda { @view_model.view_model_class_for @model }.should_not raise_error
90
- end
91
- it 'should return the right class' do
92
- @view_model.view_model_class_for(@model).should == ViewModels::SubSubclass
93
- end
94
- end
95
- end
96
-
97
- describe 'capture in view model method' do
98
- context 'template' do
99
- it 'should capture the content of the block' do
100
- @view_model.render_as(:capture_in_template).should == 'Capturing: A Pirate!'
101
- end
102
- end
103
- context 'in view model' do
104
- it 'should capture the content of the block' do
105
- @view_model.render_as(:capture_in_view_model).should == 'Capturing: A Pirate!'
106
- end
107
- end
108
- end
109
-
110
- describe 'controller context' do
111
- it 'should work' do
112
- controller = ActionController::Base.new
113
-
114
- lambda {
115
- ViewModels::SubSubclass.new @model, controller
116
- }.should_not raise_error
117
- end
118
- end
119
-
120
- describe 'view_model_for inclusion in view' do
121
- it 'should be included' do
122
- view = ActionView::Base.new
123
-
124
- lambda {
125
- view.view_model_for @model
126
- }.should_not raise_error
127
- end
128
- end
129
-
130
- describe 'collection rendering' do
131
- context 'default format' do
132
- it 'should render a html list' do
133
- @view_model.render_as(:list_example).should == "<ol class=\"collection\"><li>_list_item.html.erb</li><li>_list_item.html.erb</li></ol>"
134
- end
135
- it 'should render a html collection' do
136
- @view_model.render_as(:collection_example).should == "<ul class=\"collection\"><li>_collection_item.html.erb</li><li>_collection_item.html.erb</li></ul>"
137
- end
138
- end
139
- context 'format html' do
140
- it 'should render a html list' do
141
- @view_model.render_as(:list_example, :format => :html).should == "<ol class=\"collection\"><li>_list_item.html.erb</li><li>_list_item.html.erb</li></ol>"
142
- end
143
- it 'should render a html collection' do
144
- @view_model.render_as(:collection_example, :format => :html).should == "<ul class=\"collection\"><li>_collection_item.html.erb</li><li>_collection_item.html.erb</li></ul>"
145
- end
146
- end
147
- context 'format text' do
148
- it 'should render a text list' do
149
- @view_model.render_as(:list_example, :format => :text).should == '_list_item.text.erb\n_list_item.text.erb'
150
- end
151
- it 'should render a text collection' do
152
- @view_model.render_as(:collection_example, :format => :text).should == '_collection_item.text.erb_collection_item.text.erb'
153
- end
154
- end
155
- end
156
-
157
- describe 'model attributes' do
158
- it 'should pass through unfiltered attributes' do
159
- @view_model.some_untouched_attribute.should == :some_value
160
- end
161
- it 'should filter some attributes' do
162
- @view_model.some_filtered_attribute.should == '%3Cscript%3Efilter+me%3C%2Fscript%3E'
163
- end
164
- it 'should filter some attributes multiple times' do
165
- @view_model.some_doubly_doubled_attribute.should == 'blahblahblahblah'
166
- end
167
- it 'should filter some attributes multiple times correctly' do
168
- @view_model.some_mangled_attribute.should == 'DCBDCB'
169
- end
170
- end
171
-
172
- describe 'controller_method' do
173
- it 'should delegate to the context' do
174
- @view_model.logger.should == @logger
175
- end
176
- end
177
-
178
- describe "render_template" do
179
- it "should render the right template" do
180
- @view_model.render_template(:show).should == 'show.html.erb'
181
- end
182
- it "should render the right template with format" do
183
- @view_model.render_template(:show, :format => :text).should == 'show.text.erb'
184
- end
185
- end
186
-
187
- describe 'render_as' do
188
- describe 'render_the alias' do
189
- it 'should also render' do
190
- @view_model.render_the(:part_that_is_dependent_on_the_view_model).should == '_part_that_is_dependent_on_the_view_model.erb'
191
- end
192
- end
193
- describe "explicit partial rendering" do
194
- it "should render the right partial" do
195
- # If one wants explicit template rendering, he needs to work more.
196
- # Let's be opinionated here :)
197
- #
198
- @view_model.render_as(:partial => 'view_models/sub_subclass/inner', :format => :nesting).should == '_inner.nesting.erb'
199
- end
200
- end
201
- describe "nesting" do
202
- it "should render the right nested template, with an explicitly defined format (see template)" do
203
- @view_model.render_as(:outer, :format => :explicit).should == '_inner.also_explicit.erb'
204
- end
205
- it "should render the right nested template, respecting the already defined format" do
206
- @view_model.render_as(:outer, :format => :nesting).should == '_inner.nesting.erb'
207
- end
208
- end
209
- describe 'template inheritance' do
210
- it 'should raise ViewModels::MissingTemplateError if template is not found' do
211
- lambda { @view_model.render_as(:this_template_does_not_exist_at_allllll) }.should raise_error(ViewModels::MissingTemplateError, "No template '_this_template_does_not_exist_at_allllll' with default format found.")
212
- end
213
- it 'should raise ViewModels::MissingTemplateError if template is not found, with specific path' do
214
- lambda { @view_model.render_as(:partial => 'view_models/sub_subclass/this_template_does_not_exist_at_allllll') }.should raise_error(ViewModels::MissingTemplateError, "No template 'view_models/sub_subclass/_this_template_does_not_exist_at_allllll' with default format found.")
215
- end
216
- it 'should raise ViewModels::MissingTemplateError if template is not found, with format' do
217
- lambda { @view_model.render_as(:this_template_does_not_exist_at_allllll, :format => :gaga) }.should raise_error(ViewModels::MissingTemplateError, "No template '_this_template_does_not_exist_at_allllll' with format gaga found.")
218
- end
219
- it "should use its own template" do
220
- @view_model.render_as(:exists).should == '_exists.html.erb' # The default
221
- end
222
- it "should use the subclass' template" do
223
- @view_model.render_as(:no_sub_subclass).should == '_no_sub_subclass.erb'
224
- end
225
- end
226
- describe 'format' do
227
- it 'should render html' do
228
- @view_model.render_as(:exists, :format => nil).should == '_exists.html.erb' # the default
229
- end
230
- it 'should render erb' do
231
- @view_model.render_as(:exists, :format => '').should == '_exists.erb'
232
- end
233
- it 'should render text' do
234
- @view_model.render_as(:exists, :format => :text).should == '_exists.text.erb'
235
- end
236
- it 'should render html' do
237
- @view_model.render_as(:exists, :format => :html).should == '_exists.html.erb'
238
- end
239
- end
240
- describe 'locals' do
241
- it 'should render html' do
242
- @view_model.render_as(:exists, :locals => { :local_name => :some_local }).should == '_exists.html.erb with some_local'
243
- end
244
- it 'should render html' do
245
- @view_model.render_as(:exists, :format => nil, :locals => { :local_name => :some_local }).should == '_exists.html.erb with some_local'
246
- end
247
- it 'should render text' do
248
- @view_model.render_as(:exists, :format => '', :locals => { :local_name => :some_local }).should == '_exists.erb with some_local'
249
- end
250
- it 'should render text' do
251
- @view_model.render_as(:exists, :format => :text, :locals => { :local_name => :some_local }).should == '_exists.text.erb with some_local'
252
- end
253
- it 'should render html' do
254
- @view_model.render_as(:exists, :format => :html, :locals => { :local_name => :some_local }).should == '_exists.html.erb with some_local'
255
- end
256
- end
257
- describe 'memoizing' do
258
- it 'should memoize and not generate always a new path' do
259
- @view_model.class.should_receive(:generate_template_path_from).once
260
-
261
- @view_model.render_as :not_found_in_sub_subclass
262
- @view_model.render_as :not_found_in_sub_subclass
263
- @view_model.render_as :not_found_in_sub_subclass
264
- @view_model.render_as :not_found_in_sub_subclass
265
- @view_model.render_as :not_found_in_sub_subclass
266
- end
267
- it 'should render the right one' do
268
- @view_model.render_as :exists_in_both
269
- @view_model.render_as(:exists_in_both).should == 'in sub subclass'
270
-
271
- other_view_model = ViewModels::Subclass.new Subclass.new, @view
272
- other_view_model.render_as :exists_in_both
273
- other_view_model.render_as(:exists_in_both).should == 'in subclass'
274
-
275
- @view_model.render_as :exists_in_both
276
- @view_model.render_as(:exists_in_both).should == 'in sub subclass'
277
- end
278
- end
279
- end
280
-
281
- end
@@ -1,14 +0,0 @@
1
- class SubSubclass
2
-
3
- attr_accessor :id
4
-
5
- attr_reader :some_untouched_attribute, :some_filtered_attribute, :some_doubly_doubled_attribute, :some_mangled_attribute
6
-
7
- def initialize
8
- @some_untouched_attribute = :some_value
9
- @some_filtered_attribute = '<script>filter me</script>'
10
- @some_doubly_doubled_attribute = 'blah'
11
- @some_mangled_attribute = 'abcd'
12
- end
13
-
14
- end
@@ -1,3 +0,0 @@
1
- class Subclass
2
-
3
- end
@@ -1,7 +0,0 @@
1
- module ModuleForRendering
2
-
3
- def module_method
4
- "Hello!"
5
- end
6
-
7
- end
@@ -1,14 +0,0 @@
1
- class ViewModels::Project < ViewModels::Base
2
-
3
- helper :all
4
-
5
- # helper ActionView::Helpers::CaptureHelper
6
-
7
- helper ViewModels::Helpers::Rails
8
- helper ViewModels::Helpers::View
9
-
10
- # def output_buffer= b
11
- # view.output_buffer = b
12
- # end
13
-
14
- end
@@ -1,42 +0,0 @@
1
- class ViewModels::SubSubclass < ViewModels::Subclass
2
-
3
- controller_method :logger
4
-
5
- model_reader :some_untouched_attribute
6
- model_reader :some_filtered_attribute, :filter_through => :h
7
- model_reader :some_doubly_doubled_attribute, :filter_through => [:doubled]*2
8
- model_reader :some_mangled_attribute, :filter_through => [:reverse, :cutoff, :doubled, :upcase]
9
-
10
- # h as we know it.
11
- #
12
- def h v
13
- CGI.escape v
14
- end
15
-
16
- # Multiplies the text by 2.
17
- #
18
- def doubled text
19
- text*2
20
- end
21
-
22
- # Cuts off the last 2 characters. Or all, if less than size 2.
23
- #
24
- def cutoff text
25
- text[0..-2]
26
- end
27
-
28
- def reverse text
29
- text.reverse
30
- end
31
-
32
- def upcase text
33
- text.upcase
34
- end
35
-
36
- # Captures the block as a string.
37
- #
38
- def capture_block &block
39
- capture &block
40
- end
41
-
42
- end
@@ -1 +0,0 @@
1
- class ViewModels::Subclass < ViewModels::Project; end
@@ -1 +0,0 @@
1
- <ul class="collection"><%- collection.each do |item| -%><%- view_model = view_model_for item -%><li><%- options = template_format ? { :format => template_format } : {} -%><%= view_model.render_as template_name, options -%></li><%= separator unless item == collection.last %><%- end -%></ul>
@@ -1,6 +0,0 @@
1
- <%- collection.each do |item| -%>
2
- <%- view_model = view_model_for item -%>
3
- <%- options = (template_format ? { :format => template_format } : {}) -%>
4
- <%= view_model.render_as template_name, options -%>
5
- <%= separator unless item == collection.entries.last -%>
6
- <%- end -%>