view_models 2.0.1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.bundle/config +2 -0
- data/.gitignore +8 -0
- data/.rspec +2 -0
- data/.rvmrc +1 -0
- data/.travis.yml +19 -0
- data/.yardoc/checksums +13 -0
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
- data/Appraisals +15 -0
- data/CHANGELOG +31 -0
- data/Gemfile +13 -0
- data/Gemfile.lock +174 -0
- data/MIT-LICENSE +20 -0
- data/README.textile +199 -0
- data/Rakefile +24 -0
- data/doc/ModulesInRenderHierarchy.html +186 -0
- data/doc/ModulesInRenderHierarchy/ClassMethods.html +188 -0
- data/doc/ViewModels.html +202 -0
- data/doc/ViewModels/Base.html +1342 -0
- data/doc/ViewModels/ContextExtractor.html +406 -0
- data/doc/ViewModels/Extensions.html +128 -0
- data/doc/ViewModels/Extensions/ModelReader.html +255 -0
- data/doc/ViewModels/Extensions/ModelReader/FilteredDelegationInstaller.html +908 -0
- data/doc/ViewModels/Extensions/ModelReader/Options.html +551 -0
- data/doc/ViewModels/Extensions/View.html +303 -0
- data/doc/ViewModels/Helpers.html +129 -0
- data/doc/ViewModels/Helpers/Mapping.html +562 -0
- data/doc/ViewModels/Helpers/Mapping/Collection.html +844 -0
- data/doc/ViewModels/Helpers/View.html +287 -0
- data/doc/ViewModels/PathStore.html +745 -0
- data/doc/ViewModels/RenderOptions.html +126 -0
- data/doc/ViewModels/RenderOptions/Base.html +1187 -0
- data/doc/ViewModels/RenderOptions/Partial.html +231 -0
- data/doc/ViewModels/RenderOptions/Template.html +231 -0
- data/doc/ViewModels/View.html +414 -0
- data/doc/ViewModelsGenerator.html +410 -0
- data/doc/_index.html +317 -0
- data/doc/class_list.html +53 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +328 -0
- data/doc/file.README.html +113 -0
- data/doc/file_list.html +55 -0
- data/doc/frames.html +28 -0
- data/doc/index.html +113 -0
- data/doc/js/app.js +214 -0
- data/doc/js/full_list.js +173 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +628 -0
- data/doc/top-level-namespace.html +114 -0
- data/feature_support/testapp/app/controllers/heroes_controller.rb +6 -0
- data/feature_support/testapp/app/controllers/users_controller.rb +6 -0
- data/feature_support/testapp/app/helpers/application_helper.rb +8 -0
- data/feature_support/testapp/app/models/hero.rb +8 -0
- data/feature_support/testapp/app/models/user.rb +3 -0
- data/feature_support/testapp/app/view_models/hero.rb +8 -0
- data/feature_support/testapp/app/view_models/test.rb +8 -0
- data/feature_support/testapp/app/view_models/user.rb +14 -0
- data/feature_support/testapp/app/views/heroes/show.html.slim +6 -0
- data/feature_support/testapp/app/views/users/_box.html.slim +8 -0
- data/feature_support/testapp/app/views/users/show.html.slim +6 -0
- data/feature_support/testapp/config/application.rb +64 -0
- data/feature_support/testapp/config/cucumber.yml +8 -0
- data/feature_support/testapp/config/database.yml +28 -0
- data/feature_support/testapp/config/environments/cucumber.rb +11 -0
- data/feature_support/testapp/config/environments/test.rb +27 -0
- data/feature_support/testapp/config/routes.rb +4 -0
- data/feature_support/testapp/db/migrate/1_create_users.rb +13 -0
- data/feature_support/testapp/features/inheritance.feature +16 -0
- data/feature_support/testapp/features/step_definitions/testapp_steps.rb +16 -0
- data/feature_support/testapp/features/support/env.rb +13 -0
- data/feature_support/testapp/features/users.feature +15 -0
- data/feature_support/testapp/lib/tasks/cucumber.rake +31 -0
- data/feature_support/testapp/spec/factories/heroes.rb +7 -0
- data/feature_support/testapp/spec/factories/users.rb +7 -0
- data/features/rails_integration.feature +21 -0
- data/features/step_definitions/rails_steps.rb +112 -0
- data/features/support/env.rb +6 -0
- data/gemfiles/3.0.Gemfile +13 -0
- data/gemfiles/3.1.Gemfile +15 -0
- data/gemfiles/3.2.gemfile +15 -0
- data/lib/rails/generators/view_models/USAGE +6 -0
- data/lib/rails/generators/view_models/templates/views/_collection.html.erb +6 -0
- data/lib/{rails2/generators/view_models/templates/views/view_models/collection → rails/generators/view_models/templates/views}/_collection.html.haml +1 -2
- data/lib/rails/generators/view_models/templates/views/_collection.html.slim +6 -0
- data/lib/{rails2/generators/view_models/templates/views/_empty.html.haml → rails/generators/view_models/templates/views/_empty.html.erb} +0 -0
- data/lib/rails/generators/view_models/templates/views/_empty.html.haml +0 -0
- data/lib/rails/generators/view_models/templates/views/_empty.html.slim +0 -0
- data/lib/rails/generators/view_models/templates/views/_list.html.erb +6 -0
- data/lib/rails/generators/view_models/templates/views/_list.html.haml +4 -0
- data/lib/rails/generators/view_models/templates/views/_list.html.slim +5 -0
- data/lib/rails/generators/view_models/templates/views/_pagination.html.erb +18 -0
- data/lib/{rails2/generators/view_models/templates/views/view_models/collection → rails/generators/view_models/templates/views}/_pagination.html.haml +2 -2
- data/lib/rails/generators/view_models/templates/views/_pagination.html.slim +12 -0
- data/lib/rails/generators/view_models/templates/views/_table.html.erb +10 -0
- data/lib/{rails2/generators/view_models/templates/views/view_models/collection → rails/generators/view_models/templates/views}/_table.html.haml +0 -0
- data/lib/rails/generators/view_models/templates/views/_table.html.slim +5 -0
- data/lib/rails/generators/view_models/view_models_generator.rb +57 -0
- data/lib/view_models.rb +15 -5
- data/lib/{shared/lib/view_models → view_models}/base.rb +148 -37
- data/lib/{shared/lib/view_models → view_models}/context_extractor.rb +6 -2
- data/lib/{shared/lib/view_models → view_models}/extensions/model_reader.rb +27 -13
- data/lib/{rails2/lib → view_models}/extensions/view.rb +6 -1
- data/lib/view_models/helpers/collection.rb +113 -0
- data/lib/{shared/lib/view_models → view_models}/helpers/mapping.rb +12 -15
- data/lib/{rails2/lib → view_models}/helpers/view.rb +5 -1
- data/lib/{shared/lib/view_models → view_models}/path_store.rb +6 -1
- data/lib/{shared/lib/view_models → view_models}/render_options.rb +19 -4
- data/lib/view_models/version.rb +5 -0
- data/lib/{rails2/lib/view_models → view_models}/view.rb +7 -6
- data/spec/{rails2/lib → lib}/view_models/base_spec.rb +38 -5
- data/spec/{rails2/lib → lib/view_models}/extensions/model_reader_spec.rb +4 -4
- data/spec/{shared/lib → lib/view_models}/helpers/collection_spec.rb +21 -1
- data/spec/{shared/lib → lib/view_models}/helpers/mapping_spec.rb +6 -5
- data/spec/{rails2/lib → lib/view_models}/helpers/view_spec.rb +1 -1
- data/spec/lib/view_models/view_spec.rb +42 -0
- data/spec/spec_helper.rb +32 -0
- data/spec/spec_helper_extensions.rb +13 -0
- data/view_models.gemspec +36 -0
- metadata +411 -142
- data/lib/init.rb +0 -1
- data/lib/padrino/README.textile +0 -3
- data/lib/padrino/init.rb +0 -10
- data/lib/padrino/lib/helpers/collection.rb +0 -27
- data/lib/padrino/lib/padrino/view_models.rb +0 -19
- data/lib/padrino/lib/view_models/base.rb +0 -65
- data/lib/rails2/README.textile +0 -3
- data/lib/rails2/TODO.textile +0 -5
- data/lib/rails2/generators/view_models/USAGE +0 -6
- data/lib/rails2/generators/view_models/templates/README +0 -1
- data/lib/rails2/generators/view_models/templates/spec/view_model_spec.rb +0 -7
- data/lib/rails2/generators/view_models/templates/view_models/view_model.rb +0 -5
- data/lib/rails2/generators/view_models/templates/views/view_models/collection/_collection.html.erb +0 -1
- data/lib/rails2/generators/view_models/templates/views/view_models/collection/_collection.text.erb +0 -6
- data/lib/rails2/generators/view_models/templates/views/view_models/collection/_list.html.erb +0 -1
- data/lib/rails2/generators/view_models/templates/views/view_models/collection/_list.text.erb +0 -6
- data/lib/rails2/generators/view_models/templates/views/view_models/collection/_pagination.text.erb +0 -3
- data/lib/rails2/generators/view_models/templates/views/view_models/collection/_table.text.erb +0 -10
- data/lib/rails2/generators/view_models/view_models_generator.rb +0 -47
- data/lib/rails2/init.rb +0 -18
- data/lib/rails2/lib/experimental/README.textile +0 -32
- data/lib/rails2/lib/experimental/modules_in_render_hierarchy.rb +0 -21
- data/lib/rails2/lib/helpers/collection.rb +0 -27
- data/lib/rails2/lib/view_models.rb +0 -1
- data/lib/rails2/lib/view_models/base.rb +0 -99
- data/lib/shared/README.textile +0 -3
- data/lib/shared/init.rb +0 -11
- data/lib/shared/lib/view_models.rb +0 -4
- data/lib/shared/lib/view_models/extensions/active_record.rb +0 -27
- data/lib/shared/lib/view_models/helpers/collection.rb +0 -110
- data/spec/padrino/integration/integration_spec.rb +0 -287
- data/spec/padrino/lib/helpers/collection_spec.rb +0 -30
- data/spec/rails2/integration/integration_spec.rb +0 -279
- data/spec/rails2/lib/extensions/active_record_spec.rb +0 -31
- data/spec/rails2/lib/helpers/collection_spec.rb +0 -30
- data/spec/rails2/lib/view_models/view_spec.rb +0 -12
@@ -0,0 +1,303 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Module: ViewModels::Extensions::View
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.3
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../../';
|
20
|
+
framesUrl = "../../frames.html#!" + escape(window.location.href);
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../../_index.html">Index (V)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../../ViewModels.html" title="ViewModels (module)">ViewModels</a></span></span> » <span class='title'><span class='object_link'><a href="../Extensions.html" title="ViewModels::Extensions (module)">Extensions</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">View</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Module: ViewModels::Extensions::View
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<dt class="r1 last">Defined in:</dt>
|
82
|
+
<dd class="r1 last">lib/view_models/extensions/view.rb</dd>
|
83
|
+
|
84
|
+
</dl>
|
85
|
+
<div class="clear"></div>
|
86
|
+
|
87
|
+
<h2>Overview</h2><div class="docstring">
|
88
|
+
<div class="discussion">
|
89
|
+
|
90
|
+
<p>Extensions for the View instance</p>
|
91
|
+
|
92
|
+
|
93
|
+
</div>
|
94
|
+
</div>
|
95
|
+
<div class="tags">
|
96
|
+
|
97
|
+
|
98
|
+
</div>
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
<h2>
|
107
|
+
Instance Method Summary
|
108
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
109
|
+
</h2>
|
110
|
+
|
111
|
+
<ul class="summary">
|
112
|
+
|
113
|
+
<li class="public ">
|
114
|
+
<span class="summary_signature">
|
115
|
+
|
116
|
+
<a href="#find_template-instance_method" title="#find_template (instance method)">- (Object) <strong>find_template</strong>(path) </a>
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
</span>
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
<span class="summary_desc"><div class='inline'>
|
131
|
+
<p>Finds the template in the view paths at the given path, with its format.</p>
|
132
|
+
</div></span>
|
133
|
+
|
134
|
+
</li>
|
135
|
+
|
136
|
+
|
137
|
+
<li class="public ">
|
138
|
+
<span class="summary_signature">
|
139
|
+
|
140
|
+
<a href="#render_with-instance_method" title="#render_with (instance method)">- (Object) <strong>render_with</strong>(options) </a>
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
</span>
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
<span class="summary_desc"><div class='inline'>
|
155
|
+
<p>Renders the template with the given options.</p>
|
156
|
+
</div></span>
|
157
|
+
|
158
|
+
</li>
|
159
|
+
|
160
|
+
|
161
|
+
</ul>
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
<div id="instance_method_details" class="method_details_list">
|
167
|
+
<h2>Instance Method Details</h2>
|
168
|
+
|
169
|
+
|
170
|
+
<div class="method_details first">
|
171
|
+
<h3 class="signature first" id="find_template-instance_method">
|
172
|
+
|
173
|
+
- (<tt>Object</tt>) <strong>find_template</strong>(path)
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
</h3><div class="docstring">
|
180
|
+
<div class="discussion">
|
181
|
+
|
182
|
+
<p>Finds the template in the view paths at the given path, with its format.</p>
|
183
|
+
|
184
|
+
|
185
|
+
</div>
|
186
|
+
</div>
|
187
|
+
<div class="tags">
|
188
|
+
<p class="tag_title">Parameters:</p>
|
189
|
+
<ul class="param">
|
190
|
+
|
191
|
+
<li>
|
192
|
+
|
193
|
+
<span class='name'>path</span>
|
194
|
+
|
195
|
+
|
196
|
+
<span class='type'>(<tt>String</tt>)</span>
|
197
|
+
|
198
|
+
|
199
|
+
|
200
|
+
—
|
201
|
+
<div class='inline'>
|
202
|
+
<p>the template path</p>
|
203
|
+
</div>
|
204
|
+
|
205
|
+
</li>
|
206
|
+
|
207
|
+
</ul>
|
208
|
+
|
209
|
+
|
210
|
+
</div><table class="source_code">
|
211
|
+
<tr>
|
212
|
+
<td>
|
213
|
+
<pre class="lines">
|
214
|
+
|
215
|
+
|
216
|
+
23
|
217
|
+
24
|
218
|
+
25</pre>
|
219
|
+
</td>
|
220
|
+
<td>
|
221
|
+
<pre class="code"><span class="info file"># File 'lib/view_models/extensions/view.rb', line 23</span>
|
222
|
+
|
223
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_find_template'>find_template</span> <span class='id identifier rubyid_path'>path</span>
|
224
|
+
<span class='id identifier rubyid_view_paths'>view_paths</span><span class='period'>.</span><span class='id identifier rubyid_find_template'>find_template</span> <span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_template_format'>template_format</span> <span class='kw'>rescue</span> <span class='kw'>nil</span>
|
225
|
+
<span class='kw'>end</span></pre>
|
226
|
+
</td>
|
227
|
+
</tr>
|
228
|
+
</table>
|
229
|
+
</div>
|
230
|
+
|
231
|
+
<div class="method_details ">
|
232
|
+
<h3 class="signature " id="render_with-instance_method">
|
233
|
+
|
234
|
+
- (<tt>Object</tt>) <strong>render_with</strong>(options)
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
</h3><div class="docstring">
|
241
|
+
<div class="discussion">
|
242
|
+
|
243
|
+
<p>Renders the template with the given options</p>
|
244
|
+
|
245
|
+
|
246
|
+
</div>
|
247
|
+
</div>
|
248
|
+
<div class="tags">
|
249
|
+
<p class="tag_title">Parameters:</p>
|
250
|
+
<ul class="param">
|
251
|
+
|
252
|
+
<li>
|
253
|
+
|
254
|
+
<span class='name'>options</span>
|
255
|
+
|
256
|
+
|
257
|
+
<span class='type'>(<tt><span class='object_link'><a href="../RenderOptions/Base.html" title="ViewModels::RenderOptions::Base (class)">RenderOptions::Base</a></span></tt>)</span>
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
—
|
262
|
+
<div class='inline'>
|
263
|
+
<p>The options to render with</p>
|
264
|
+
</div>
|
265
|
+
|
266
|
+
</li>
|
267
|
+
|
268
|
+
</ul>
|
269
|
+
|
270
|
+
|
271
|
+
</div><table class="source_code">
|
272
|
+
<tr>
|
273
|
+
<td>
|
274
|
+
<pre class="lines">
|
275
|
+
|
276
|
+
|
277
|
+
16
|
278
|
+
17
|
279
|
+
18</pre>
|
280
|
+
</td>
|
281
|
+
<td>
|
282
|
+
<pre class="code"><span class="info file"># File 'lib/view_models/extensions/view.rb', line 16</span>
|
283
|
+
|
284
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_render_with'>render_with</span> <span class='id identifier rubyid_options'>options</span>
|
285
|
+
<span class='id identifier rubyid_render'>render</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_to_render_options'>to_render_options</span>
|
286
|
+
<span class='kw'>end</span></pre>
|
287
|
+
</td>
|
288
|
+
</tr>
|
289
|
+
</table>
|
290
|
+
</div>
|
291
|
+
|
292
|
+
</div>
|
293
|
+
|
294
|
+
</div>
|
295
|
+
|
296
|
+
<div id="footer">
|
297
|
+
Generated on Tue Oct 16 23:27:34 2012 by
|
298
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
299
|
+
0.8.3 (ruby-1.9.3).
|
300
|
+
</div>
|
301
|
+
|
302
|
+
</body>
|
303
|
+
</html>
|
@@ -0,0 +1,129 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Module: ViewModels::Helpers
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.3
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../';
|
20
|
+
framesUrl = "../frames.html#!" + escape(window.location.href);
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../_index.html">Index (H)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../ViewModels.html" title="ViewModels (module)">ViewModels</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">Helpers</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Module: ViewModels::Helpers
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<dt class="r1 last">Defined in:</dt>
|
82
|
+
<dd class="r1 last">lib/view_models/helpers/collection.rb<span class="defines">,<br />
|
83
|
+
lib/view_models/helpers/view.rb,<br /> lib/view_models/helpers/mapping.rb</span>
|
84
|
+
</dd>
|
85
|
+
|
86
|
+
</dl>
|
87
|
+
<div class="clear"></div>
|
88
|
+
|
89
|
+
<h2>Overview</h2><div class="docstring">
|
90
|
+
<div class="discussion">
|
91
|
+
|
92
|
+
<p>Helpers you can include in just about anything to get convenient access to
|
93
|
+
view model functionality</p>
|
94
|
+
|
95
|
+
|
96
|
+
</div>
|
97
|
+
</div>
|
98
|
+
<div class="tags">
|
99
|
+
|
100
|
+
|
101
|
+
</div><h2>Defined Under Namespace</h2>
|
102
|
+
<p class="children">
|
103
|
+
|
104
|
+
|
105
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Helpers/Mapping.html" title="ViewModels::Helpers::Mapping (module)">Mapping</a></span>, <span class='object_link'><a href="Helpers/View.html" title="ViewModels::Helpers::View (module)">View</a></span>
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
</p>
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
</div>
|
121
|
+
|
122
|
+
<div id="footer">
|
123
|
+
Generated on Tue Oct 16 23:27:34 2012 by
|
124
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
125
|
+
0.8.3 (ruby-1.9.3).
|
126
|
+
</div>
|
127
|
+
|
128
|
+
</body>
|
129
|
+
</html>
|
@@ -0,0 +1,562 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Module: ViewModels::Helpers::Mapping
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.3
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../../';
|
20
|
+
framesUrl = "../../frames.html#!" + escape(window.location.href);
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../../_index.html">Index (M)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../../ViewModels.html" title="ViewModels (module)">ViewModels</a></span></span> » <span class='title'><span class='object_link'><a href="../Helpers.html" title="ViewModels::Helpers (module)">Helpers</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">Mapping</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Module: ViewModels::Helpers::Mapping
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<dt class="r1 last">Defined in:</dt>
|
82
|
+
<dd class="r1 last">lib/view_models/helpers/collection.rb<span class="defines">,<br />
|
83
|
+
lib/view_models/helpers/mapping.rb</span>
|
84
|
+
</dd>
|
85
|
+
|
86
|
+
</dl>
|
87
|
+
<div class="clear"></div>
|
88
|
+
|
89
|
+
<h2>Overview</h2><div class="docstring">
|
90
|
+
<div class="discussion">
|
91
|
+
|
92
|
+
<p>Mapping helpers install collection_view_model_for and view_model_for, which
|
93
|
+
you can use with instances to conveniently instantiate a view model for it</p>
|
94
|
+
|
95
|
+
|
96
|
+
</div>
|
97
|
+
</div>
|
98
|
+
<div class="tags">
|
99
|
+
|
100
|
+
|
101
|
+
</div><h2>Defined Under Namespace</h2>
|
102
|
+
<p class="children">
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Mapping/Collection.html" title="ViewModels::Helpers::Mapping::Collection (class)">Collection</a></span>
|
108
|
+
|
109
|
+
|
110
|
+
</p>
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
<h2>
|
120
|
+
Instance Method Summary
|
121
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
122
|
+
</h2>
|
123
|
+
|
124
|
+
<ul class="summary">
|
125
|
+
|
126
|
+
<li class="public ">
|
127
|
+
<span class="summary_signature">
|
128
|
+
|
129
|
+
<a href="#collection_view_model_for-instance_method" title="#collection_view_model_for (instance method)">- (Object) <strong>collection_view_model_for</strong>(array_or_pagination, context = self) </a>
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
</span>
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
<span class="summary_desc"><div class='inline'>
|
144
|
+
<p>Construct a view_model for a collection.</p>
|
145
|
+
</div></span>
|
146
|
+
|
147
|
+
</li>
|
148
|
+
|
149
|
+
|
150
|
+
<li class="public ">
|
151
|
+
<span class="summary_signature">
|
152
|
+
|
153
|
+
<a href="#default_view_model_class_for-instance_method" title="#default_view_model_class_for (instance method)">- (Object) <strong>default_view_model_class_for</strong>(model) </a>
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
</span>
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
<span class="summary_desc"><div class='inline'>
|
168
|
+
<p>Returns the default view_model class for the given model instance.</p>
|
169
|
+
</div></span>
|
170
|
+
|
171
|
+
</li>
|
172
|
+
|
173
|
+
|
174
|
+
<li class="public ">
|
175
|
+
<span class="summary_signature">
|
176
|
+
|
177
|
+
<a href="#specific_view_model_class_for-instance_method" title="#specific_view_model_class_for (instance method)">- (Object) <strong>specific_view_model_class_for</strong>(model) </a>
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
</span>
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
<span class="summary_desc"><div class='inline'>
|
192
|
+
<p>Returns a specific view_model class for the given model instance.</p>
|
193
|
+
</div></span>
|
194
|
+
|
195
|
+
</li>
|
196
|
+
|
197
|
+
|
198
|
+
<li class="public ">
|
199
|
+
<span class="summary_signature">
|
200
|
+
|
201
|
+
<a href="#view_model_class_for-instance_method" title="#view_model_class_for (instance method)">- (Object) <strong>view_model_class_for</strong>(model) </a>
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
</span>
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
<span class="summary_desc"><div class='inline'>
|
216
|
+
<p>Get the view_model class for the given model instance.</p>
|
217
|
+
</div></span>
|
218
|
+
|
219
|
+
</li>
|
220
|
+
|
221
|
+
|
222
|
+
<li class="public ">
|
223
|
+
<span class="summary_signature">
|
224
|
+
|
225
|
+
<a href="#view_model_for-instance_method" title="#view_model_for (instance method)">- (Object) <strong>view_model_for</strong>(model, context = self) </a>
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
</span>
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
<span class="summary_desc"><div class='inline'>
|
240
|
+
<p>Create a new view_model instance for the given model instance with the
|
241
|
+
given arguments.</p>
|
242
|
+
</div></span>
|
243
|
+
|
244
|
+
</li>
|
245
|
+
|
246
|
+
|
247
|
+
</ul>
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
<div id="instance_method_details" class="method_details_list">
|
253
|
+
<h2>Instance Method Details</h2>
|
254
|
+
|
255
|
+
|
256
|
+
<div class="method_details first">
|
257
|
+
<h3 class="signature first" id="collection_view_model_for-instance_method">
|
258
|
+
|
259
|
+
- (<tt>Object</tt>) <strong>collection_view_model_for</strong>(array_or_pagination, context = self)
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
</h3><div class="docstring">
|
266
|
+
<div class="discussion">
|
267
|
+
|
268
|
+
<div class="note todo">
|
269
|
+
<strong>TODO:</strong>
|
270
|
+
<div class='inline'>
|
271
|
+
<p>Think about moving it into view_model_for, or renaming it view_models_for.</p>
|
272
|
+
</div>
|
273
|
+
</div>
|
274
|
+
|
275
|
+
|
276
|
+
<p>Construct a view_model for a collection.</p>
|
277
|
+
|
278
|
+
|
279
|
+
</div>
|
280
|
+
</div>
|
281
|
+
<div class="tags">
|
282
|
+
|
283
|
+
|
284
|
+
</div><table class="source_code">
|
285
|
+
<tr>
|
286
|
+
<td>
|
287
|
+
<pre class="lines">
|
288
|
+
|
289
|
+
|
290
|
+
16
|
291
|
+
17
|
292
|
+
18</pre>
|
293
|
+
</td>
|
294
|
+
<td>
|
295
|
+
<pre class="code"><span class="info file"># File 'lib/view_models/helpers/collection.rb', line 16</span>
|
296
|
+
|
297
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_collection_view_model_for'>collection_view_model_for</span> <span class='id identifier rubyid_array_or_pagination'>array_or_pagination</span><span class='comma'>,</span> <span class='id identifier rubyid_context'>context</span> <span class='op'>=</span> <span class='kw'>self</span>
|
298
|
+
<span class='const'>Collection</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='id identifier rubyid_array_or_pagination'>array_or_pagination</span><span class='comma'>,</span> <span class='id identifier rubyid_context'>context</span>
|
299
|
+
<span class='kw'>end</span></pre>
|
300
|
+
</td>
|
301
|
+
</tr>
|
302
|
+
</table>
|
303
|
+
</div>
|
304
|
+
|
305
|
+
<div class="method_details ">
|
306
|
+
<h3 class="signature " id="default_view_model_class_for-instance_method">
|
307
|
+
|
308
|
+
- (<tt>Object</tt>) <strong>default_view_model_class_for</strong>(model)
|
309
|
+
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
</h3><div class="docstring">
|
315
|
+
<div class="discussion">
|
316
|
+
|
317
|
+
<p>Returns the default view_model class for the given model instance.</p>
|
318
|
+
|
319
|
+
<p>Default class name is: ViewModels::<ModelClassName></p>
|
320
|
+
|
321
|
+
<p>Override this method if you'd like to change the <em>default</em>
|
322
|
+
model-to-view_model class mapping.</p>
|
323
|
+
|
324
|
+
|
325
|
+
</div>
|
326
|
+
</div>
|
327
|
+
<div class="tags">
|
328
|
+
|
329
|
+
<p class="tag_title">Raises:</p>
|
330
|
+
<ul class="raise">
|
331
|
+
|
332
|
+
<li>
|
333
|
+
|
334
|
+
|
335
|
+
<span class='type'>(<tt>NameError</tt>)</span>
|
336
|
+
|
337
|
+
|
338
|
+
|
339
|
+
—
|
340
|
+
<div class='inline'>
|
341
|
+
<p>if a corresponding ViewModels constant cannot be loaded.</p>
|
342
|
+
</div>
|
343
|
+
|
344
|
+
</li>
|
345
|
+
|
346
|
+
</ul>
|
347
|
+
|
348
|
+
</div><table class="source_code">
|
349
|
+
<tr>
|
350
|
+
<td>
|
351
|
+
<pre class="lines">
|
352
|
+
|
353
|
+
|
354
|
+
42
|
355
|
+
43
|
356
|
+
44</pre>
|
357
|
+
</td>
|
358
|
+
<td>
|
359
|
+
<pre class="code"><span class="info file"># File 'lib/view_models/helpers/mapping.rb', line 42</span>
|
360
|
+
|
361
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_default_view_model_class_for'>default_view_model_class_for</span> <span class='id identifier rubyid_model'>model</span>
|
362
|
+
<span class='lparen'>(</span><span class='id identifier rubyid_default_prefix'>default_prefix</span> <span class='op'>+</span> <span class='id identifier rubyid_model'>model</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_constantize'>constantize</span>
|
363
|
+
<span class='kw'>end</span></pre>
|
364
|
+
</td>
|
365
|
+
</tr>
|
366
|
+
</table>
|
367
|
+
</div>
|
368
|
+
|
369
|
+
<div class="method_details ">
|
370
|
+
<h3 class="signature " id="specific_view_model_class_for-instance_method">
|
371
|
+
|
372
|
+
- (<tt>Object</tt>) <strong>specific_view_model_class_for</strong>(model)
|
373
|
+
|
374
|
+
|
375
|
+
|
376
|
+
|
377
|
+
|
378
|
+
</h3><div class="docstring">
|
379
|
+
<div class="discussion">
|
380
|
+
|
381
|
+
<p>Returns a specific view_model class for the given model instance.</p>
|
382
|
+
|
383
|
+
<p>Override this method, if you want to return a specific view model class for
|
384
|
+
the given model.</p>
|
385
|
+
|
386
|
+
|
387
|
+
</div>
|
388
|
+
</div>
|
389
|
+
<div class="tags">
|
390
|
+
|
391
|
+
<p class="tag_title">Raises:</p>
|
392
|
+
<ul class="raise">
|
393
|
+
|
394
|
+
<li>
|
395
|
+
|
396
|
+
|
397
|
+
<span class='type'>(<tt>NameError</tt>)</span>
|
398
|
+
|
399
|
+
|
400
|
+
|
401
|
+
—
|
402
|
+
<div class='inline'>
|
403
|
+
<p>if a corresponding ViewModels constant cannot be loaded.</p>
|
404
|
+
</div>
|
405
|
+
|
406
|
+
</li>
|
407
|
+
|
408
|
+
</ul>
|
409
|
+
|
410
|
+
</div><table class="source_code">
|
411
|
+
<tr>
|
412
|
+
<td>
|
413
|
+
<pre class="lines">
|
414
|
+
|
415
|
+
|
416
|
+
53
|
417
|
+
54
|
418
|
+
55</pre>
|
419
|
+
</td>
|
420
|
+
<td>
|
421
|
+
<pre class="code"><span class="info file"># File 'lib/view_models/helpers/mapping.rb', line 53</span>
|
422
|
+
|
423
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_specific_view_model_class_for'>specific_view_model_class_for</span> <span class='id identifier rubyid_model'>model</span>
|
424
|
+
<span class='id identifier rubyid_specific_view_model_mapping'>specific_view_model_mapping</span><span class='lbracket'>[</span><span class='id identifier rubyid_model'>model</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='rbracket'>]</span>
|
425
|
+
<span class='kw'>end</span></pre>
|
426
|
+
</td>
|
427
|
+
</tr>
|
428
|
+
</table>
|
429
|
+
</div>
|
430
|
+
|
431
|
+
<div class="method_details ">
|
432
|
+
<h3 class="signature " id="view_model_class_for-instance_method">
|
433
|
+
|
434
|
+
- (<tt>Object</tt>) <strong>view_model_class_for</strong>(model)
|
435
|
+
|
436
|
+
|
437
|
+
|
438
|
+
|
439
|
+
|
440
|
+
</h3><div class="docstring">
|
441
|
+
<div class="discussion">
|
442
|
+
|
443
|
+
<div class="note notetag">
|
444
|
+
<strong>Note:</strong>
|
445
|
+
<div class='inline'>
|
446
|
+
<p>ViewModels are usually of class ViewModels::<ModelClassName>. (As
|
447
|
+
returned by default_view_model_class_for). Override specific_mapping if
|
448
|
+
you'd like to install your own. Or Override
|
449
|
+
default_view_model_class_for(model) if you'd like to change the default.</p>
|
450
|
+
</div>
|
451
|
+
</div>
|
452
|
+
|
453
|
+
|
454
|
+
<p>Get the view_model class for the given model instance.</p>
|
455
|
+
|
456
|
+
|
457
|
+
</div>
|
458
|
+
</div>
|
459
|
+
<div class="tags">
|
460
|
+
|
461
|
+
|
462
|
+
</div><table class="source_code">
|
463
|
+
<tr>
|
464
|
+
<td>
|
465
|
+
<pre class="lines">
|
466
|
+
|
467
|
+
|
468
|
+
28
|
469
|
+
29
|
470
|
+
30</pre>
|
471
|
+
</td>
|
472
|
+
<td>
|
473
|
+
<pre class="code"><span class="info file"># File 'lib/view_models/helpers/mapping.rb', line 28</span>
|
474
|
+
|
475
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_view_model_class_for'>view_model_class_for</span> <span class='id identifier rubyid_model'>model</span>
|
476
|
+
<span class='id identifier rubyid_specific_view_model_class_for'>specific_view_model_class_for</span><span class='lparen'>(</span><span class='id identifier rubyid_model'>model</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_default_view_model_class_for'>default_view_model_class_for</span><span class='lparen'>(</span><span class='id identifier rubyid_model'>model</span><span class='rparen'>)</span>
|
477
|
+
<span class='kw'>end</span></pre>
|
478
|
+
</td>
|
479
|
+
</tr>
|
480
|
+
</table>
|
481
|
+
</div>
|
482
|
+
|
483
|
+
<div class="method_details ">
|
484
|
+
<h3 class="signature " id="view_model_for-instance_method">
|
485
|
+
|
486
|
+
- (<tt>Object</tt>) <strong>view_model_for</strong>(model, context = self)
|
487
|
+
|
488
|
+
|
489
|
+
|
490
|
+
|
491
|
+
|
492
|
+
</h3><div class="docstring">
|
493
|
+
<div class="discussion">
|
494
|
+
|
495
|
+
<div class="note notetag">
|
496
|
+
<strong>Note:</strong>
|
497
|
+
<div class='inline'>
|
498
|
+
<p>context is either a view instance or a controller instance.</p>
|
499
|
+
</div>
|
500
|
+
</div>
|
501
|
+
|
502
|
+
|
503
|
+
<p>Create a new view_model instance for the given model instance with the
|
504
|
+
given arguments.</p>
|
505
|
+
|
506
|
+
|
507
|
+
</div>
|
508
|
+
</div>
|
509
|
+
<div class="tags">
|
510
|
+
|
511
|
+
<p class="tag_title">Raises:</p>
|
512
|
+
<ul class="raise">
|
513
|
+
|
514
|
+
<li>
|
515
|
+
|
516
|
+
|
517
|
+
<span class='type'>(<tt>ArgumentError</tt>)</span>
|
518
|
+
|
519
|
+
|
520
|
+
|
521
|
+
—
|
522
|
+
<div class='inline'>
|
523
|
+
<p>if the view model class doesn't support 2 arguments.</p>
|
524
|
+
</div>
|
525
|
+
|
526
|
+
</li>
|
527
|
+
|
528
|
+
</ul>
|
529
|
+
|
530
|
+
</div><table class="source_code">
|
531
|
+
<tr>
|
532
|
+
<td>
|
533
|
+
<pre class="lines">
|
534
|
+
|
535
|
+
|
536
|
+
20
|
537
|
+
21
|
538
|
+
22</pre>
|
539
|
+
</td>
|
540
|
+
<td>
|
541
|
+
<pre class="code"><span class="info file"># File 'lib/view_models/helpers/mapping.rb', line 20</span>
|
542
|
+
|
543
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_view_model_for'>view_model_for</span> <span class='id identifier rubyid_model'>model</span><span class='comma'>,</span> <span class='id identifier rubyid_context'>context</span> <span class='op'>=</span> <span class='kw'>self</span>
|
544
|
+
<span class='id identifier rubyid_view_model_class_for'>view_model_class_for</span><span class='lparen'>(</span><span class='id identifier rubyid_model'>model</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='id identifier rubyid_model'>model</span><span class='comma'>,</span> <span class='id identifier rubyid_context'>context</span>
|
545
|
+
<span class='kw'>end</span></pre>
|
546
|
+
</td>
|
547
|
+
</tr>
|
548
|
+
</table>
|
549
|
+
</div>
|
550
|
+
|
551
|
+
</div>
|
552
|
+
|
553
|
+
</div>
|
554
|
+
|
555
|
+
<div id="footer">
|
556
|
+
Generated on Tue Oct 16 23:27:34 2012 by
|
557
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
558
|
+
0.8.3 (ruby-1.9.3).
|
559
|
+
</div>
|
560
|
+
|
561
|
+
</body>
|
562
|
+
</html>
|