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.
Files changed (157) hide show
  1. data/.bundle/config +2 -0
  2. data/.gitignore +8 -0
  3. data/.rspec +2 -0
  4. data/.rvmrc +1 -0
  5. data/.travis.yml +19 -0
  6. data/.yardoc/checksums +13 -0
  7. data/.yardoc/object_types +0 -0
  8. data/.yardoc/objects/root.dat +0 -0
  9. data/.yardoc/proxy_types +0 -0
  10. data/Appraisals +15 -0
  11. data/CHANGELOG +31 -0
  12. data/Gemfile +13 -0
  13. data/Gemfile.lock +174 -0
  14. data/MIT-LICENSE +20 -0
  15. data/README.textile +199 -0
  16. data/Rakefile +24 -0
  17. data/doc/ModulesInRenderHierarchy.html +186 -0
  18. data/doc/ModulesInRenderHierarchy/ClassMethods.html +188 -0
  19. data/doc/ViewModels.html +202 -0
  20. data/doc/ViewModels/Base.html +1342 -0
  21. data/doc/ViewModels/ContextExtractor.html +406 -0
  22. data/doc/ViewModels/Extensions.html +128 -0
  23. data/doc/ViewModels/Extensions/ModelReader.html +255 -0
  24. data/doc/ViewModels/Extensions/ModelReader/FilteredDelegationInstaller.html +908 -0
  25. data/doc/ViewModels/Extensions/ModelReader/Options.html +551 -0
  26. data/doc/ViewModels/Extensions/View.html +303 -0
  27. data/doc/ViewModels/Helpers.html +129 -0
  28. data/doc/ViewModels/Helpers/Mapping.html +562 -0
  29. data/doc/ViewModels/Helpers/Mapping/Collection.html +844 -0
  30. data/doc/ViewModels/Helpers/View.html +287 -0
  31. data/doc/ViewModels/PathStore.html +745 -0
  32. data/doc/ViewModels/RenderOptions.html +126 -0
  33. data/doc/ViewModels/RenderOptions/Base.html +1187 -0
  34. data/doc/ViewModels/RenderOptions/Partial.html +231 -0
  35. data/doc/ViewModels/RenderOptions/Template.html +231 -0
  36. data/doc/ViewModels/View.html +414 -0
  37. data/doc/ViewModelsGenerator.html +410 -0
  38. data/doc/_index.html +317 -0
  39. data/doc/class_list.html +53 -0
  40. data/doc/css/common.css +1 -0
  41. data/doc/css/full_list.css +57 -0
  42. data/doc/css/style.css +328 -0
  43. data/doc/file.README.html +113 -0
  44. data/doc/file_list.html +55 -0
  45. data/doc/frames.html +28 -0
  46. data/doc/index.html +113 -0
  47. data/doc/js/app.js +214 -0
  48. data/doc/js/full_list.js +173 -0
  49. data/doc/js/jquery.js +4 -0
  50. data/doc/method_list.html +628 -0
  51. data/doc/top-level-namespace.html +114 -0
  52. data/feature_support/testapp/app/controllers/heroes_controller.rb +6 -0
  53. data/feature_support/testapp/app/controllers/users_controller.rb +6 -0
  54. data/feature_support/testapp/app/helpers/application_helper.rb +8 -0
  55. data/feature_support/testapp/app/models/hero.rb +8 -0
  56. data/feature_support/testapp/app/models/user.rb +3 -0
  57. data/feature_support/testapp/app/view_models/hero.rb +8 -0
  58. data/feature_support/testapp/app/view_models/test.rb +8 -0
  59. data/feature_support/testapp/app/view_models/user.rb +14 -0
  60. data/feature_support/testapp/app/views/heroes/show.html.slim +6 -0
  61. data/feature_support/testapp/app/views/users/_box.html.slim +8 -0
  62. data/feature_support/testapp/app/views/users/show.html.slim +6 -0
  63. data/feature_support/testapp/config/application.rb +64 -0
  64. data/feature_support/testapp/config/cucumber.yml +8 -0
  65. data/feature_support/testapp/config/database.yml +28 -0
  66. data/feature_support/testapp/config/environments/cucumber.rb +11 -0
  67. data/feature_support/testapp/config/environments/test.rb +27 -0
  68. data/feature_support/testapp/config/routes.rb +4 -0
  69. data/feature_support/testapp/db/migrate/1_create_users.rb +13 -0
  70. data/feature_support/testapp/features/inheritance.feature +16 -0
  71. data/feature_support/testapp/features/step_definitions/testapp_steps.rb +16 -0
  72. data/feature_support/testapp/features/support/env.rb +13 -0
  73. data/feature_support/testapp/features/users.feature +15 -0
  74. data/feature_support/testapp/lib/tasks/cucumber.rake +31 -0
  75. data/feature_support/testapp/spec/factories/heroes.rb +7 -0
  76. data/feature_support/testapp/spec/factories/users.rb +7 -0
  77. data/features/rails_integration.feature +21 -0
  78. data/features/step_definitions/rails_steps.rb +112 -0
  79. data/features/support/env.rb +6 -0
  80. data/gemfiles/3.0.Gemfile +13 -0
  81. data/gemfiles/3.1.Gemfile +15 -0
  82. data/gemfiles/3.2.gemfile +15 -0
  83. data/lib/rails/generators/view_models/USAGE +6 -0
  84. data/lib/rails/generators/view_models/templates/views/_collection.html.erb +6 -0
  85. data/lib/{rails2/generators/view_models/templates/views/view_models/collection → rails/generators/view_models/templates/views}/_collection.html.haml +1 -2
  86. data/lib/rails/generators/view_models/templates/views/_collection.html.slim +6 -0
  87. data/lib/{rails2/generators/view_models/templates/views/_empty.html.haml → rails/generators/view_models/templates/views/_empty.html.erb} +0 -0
  88. data/lib/rails/generators/view_models/templates/views/_empty.html.haml +0 -0
  89. data/lib/rails/generators/view_models/templates/views/_empty.html.slim +0 -0
  90. data/lib/rails/generators/view_models/templates/views/_list.html.erb +6 -0
  91. data/lib/rails/generators/view_models/templates/views/_list.html.haml +4 -0
  92. data/lib/rails/generators/view_models/templates/views/_list.html.slim +5 -0
  93. data/lib/rails/generators/view_models/templates/views/_pagination.html.erb +18 -0
  94. data/lib/{rails2/generators/view_models/templates/views/view_models/collection → rails/generators/view_models/templates/views}/_pagination.html.haml +2 -2
  95. data/lib/rails/generators/view_models/templates/views/_pagination.html.slim +12 -0
  96. data/lib/rails/generators/view_models/templates/views/_table.html.erb +10 -0
  97. data/lib/{rails2/generators/view_models/templates/views/view_models/collection → rails/generators/view_models/templates/views}/_table.html.haml +0 -0
  98. data/lib/rails/generators/view_models/templates/views/_table.html.slim +5 -0
  99. data/lib/rails/generators/view_models/view_models_generator.rb +57 -0
  100. data/lib/view_models.rb +15 -5
  101. data/lib/{shared/lib/view_models → view_models}/base.rb +148 -37
  102. data/lib/{shared/lib/view_models → view_models}/context_extractor.rb +6 -2
  103. data/lib/{shared/lib/view_models → view_models}/extensions/model_reader.rb +27 -13
  104. data/lib/{rails2/lib → view_models}/extensions/view.rb +6 -1
  105. data/lib/view_models/helpers/collection.rb +113 -0
  106. data/lib/{shared/lib/view_models → view_models}/helpers/mapping.rb +12 -15
  107. data/lib/{rails2/lib → view_models}/helpers/view.rb +5 -1
  108. data/lib/{shared/lib/view_models → view_models}/path_store.rb +6 -1
  109. data/lib/{shared/lib/view_models → view_models}/render_options.rb +19 -4
  110. data/lib/view_models/version.rb +5 -0
  111. data/lib/{rails2/lib/view_models → view_models}/view.rb +7 -6
  112. data/spec/{rails2/lib → lib}/view_models/base_spec.rb +38 -5
  113. data/spec/{rails2/lib → lib/view_models}/extensions/model_reader_spec.rb +4 -4
  114. data/spec/{shared/lib → lib/view_models}/helpers/collection_spec.rb +21 -1
  115. data/spec/{shared/lib → lib/view_models}/helpers/mapping_spec.rb +6 -5
  116. data/spec/{rails2/lib → lib/view_models}/helpers/view_spec.rb +1 -1
  117. data/spec/lib/view_models/view_spec.rb +42 -0
  118. data/spec/spec_helper.rb +32 -0
  119. data/spec/spec_helper_extensions.rb +13 -0
  120. data/view_models.gemspec +36 -0
  121. metadata +411 -142
  122. data/lib/init.rb +0 -1
  123. data/lib/padrino/README.textile +0 -3
  124. data/lib/padrino/init.rb +0 -10
  125. data/lib/padrino/lib/helpers/collection.rb +0 -27
  126. data/lib/padrino/lib/padrino/view_models.rb +0 -19
  127. data/lib/padrino/lib/view_models/base.rb +0 -65
  128. data/lib/rails2/README.textile +0 -3
  129. data/lib/rails2/TODO.textile +0 -5
  130. data/lib/rails2/generators/view_models/USAGE +0 -6
  131. data/lib/rails2/generators/view_models/templates/README +0 -1
  132. data/lib/rails2/generators/view_models/templates/spec/view_model_spec.rb +0 -7
  133. data/lib/rails2/generators/view_models/templates/view_models/view_model.rb +0 -5
  134. data/lib/rails2/generators/view_models/templates/views/view_models/collection/_collection.html.erb +0 -1
  135. data/lib/rails2/generators/view_models/templates/views/view_models/collection/_collection.text.erb +0 -6
  136. data/lib/rails2/generators/view_models/templates/views/view_models/collection/_list.html.erb +0 -1
  137. data/lib/rails2/generators/view_models/templates/views/view_models/collection/_list.text.erb +0 -6
  138. data/lib/rails2/generators/view_models/templates/views/view_models/collection/_pagination.text.erb +0 -3
  139. data/lib/rails2/generators/view_models/templates/views/view_models/collection/_table.text.erb +0 -10
  140. data/lib/rails2/generators/view_models/view_models_generator.rb +0 -47
  141. data/lib/rails2/init.rb +0 -18
  142. data/lib/rails2/lib/experimental/README.textile +0 -32
  143. data/lib/rails2/lib/experimental/modules_in_render_hierarchy.rb +0 -21
  144. data/lib/rails2/lib/helpers/collection.rb +0 -27
  145. data/lib/rails2/lib/view_models.rb +0 -1
  146. data/lib/rails2/lib/view_models/base.rb +0 -99
  147. data/lib/shared/README.textile +0 -3
  148. data/lib/shared/init.rb +0 -11
  149. data/lib/shared/lib/view_models.rb +0 -4
  150. data/lib/shared/lib/view_models/extensions/active_record.rb +0 -27
  151. data/lib/shared/lib/view_models/helpers/collection.rb +0 -110
  152. data/spec/padrino/integration/integration_spec.rb +0 -287
  153. data/spec/padrino/lib/helpers/collection_spec.rb +0 -30
  154. data/spec/rails2/integration/integration_spec.rb +0 -279
  155. data/spec/rails2/lib/extensions/active_record_spec.rb +0 -31
  156. data/spec/rails2/lib/helpers/collection_spec.rb +0 -30
  157. data/spec/rails2/lib/view_models/view_spec.rb +0 -12
@@ -0,0 +1,287 @@
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::View
8
+
9
+ &mdash; 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> &raquo;
35
+ <span class='title'><span class='object_link'><a href="../../ViewModels.html" title="ViewModels (module)">ViewModels</a></span></span> &raquo; <span class='title'><span class='object_link'><a href="../Helpers.html" title="ViewModels::Helpers (module)">Helpers</a></span></span>
36
+ &raquo;
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::Helpers::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/helpers/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>Module for conveniently including common view_helpers into a view_model</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
+ Class 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="#all_view_helpers-class_method" title="all_view_helpers (class method)">+ (Array) <strong>all_view_helpers</strong> </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>The common view helpers.</p>
132
+ </div></span>
133
+
134
+ </li>
135
+
136
+
137
+ <li class="public ">
138
+ <span class="summary_signature">
139
+
140
+ <a href="#included-class_method" title="included (class method)">+ (Object) <strong>included</strong>(view_model) </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>Include hook for the view.</p>
156
+ </div></span>
157
+
158
+ </li>
159
+
160
+
161
+ </ul>
162
+
163
+
164
+
165
+
166
+ <div id="class_method_details" class="method_details_list">
167
+ <h2>Class Method Details</h2>
168
+
169
+
170
+ <div class="method_details first">
171
+ <h3 class="signature first" id="all_view_helpers-class_method">
172
+
173
+ + (<tt>Array</tt>) <strong>all_view_helpers</strong>
174
+
175
+
176
+
177
+
178
+
179
+ </h3><div class="docstring">
180
+ <div class="discussion">
181
+
182
+ <p>The common view helpers</p>
183
+
184
+
185
+ </div>
186
+ </div>
187
+ <div class="tags">
188
+
189
+ <p class="tag_title">Returns:</p>
190
+ <ul class="return">
191
+
192
+ <li>
193
+
194
+
195
+ <span class='type'>(<tt>Array</tt>)</span>
196
+
197
+
198
+
199
+ &mdash;
200
+ <div class='inline'>
201
+ <p>an array of common view helpers</p>
202
+ </div>
203
+
204
+ </li>
205
+
206
+ </ul>
207
+
208
+ </div><table class="source_code">
209
+ <tr>
210
+ <td>
211
+ <pre class="lines">
212
+
213
+
214
+ 17
215
+ 18
216
+ 19
217
+ 20
218
+ 21
219
+ 22</pre>
220
+ </td>
221
+ <td>
222
+ <pre class="code"><span class="info file"># File 'lib/view_models/helpers/view.rb', line 17</span>
223
+
224
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_all_view_helpers'>all_view_helpers</span>
225
+ <span class='lbracket'>[</span>
226
+ <span class='const'>ActionView</span><span class='op'>::</span><span class='const'>Helpers</span><span class='comma'>,</span>
227
+ <span class='const'>ERB</span><span class='op'>::</span><span class='const'>Util</span>
228
+ <span class='rbracket'>]</span>
229
+ <span class='kw'>end</span></pre>
230
+ </td>
231
+ </tr>
232
+ </table>
233
+ </div>
234
+
235
+ <div class="method_details ">
236
+ <h3 class="signature " id="included-class_method">
237
+
238
+ + (<tt>Object</tt>) <strong>included</strong>(view_model)
239
+
240
+
241
+
242
+
243
+
244
+ </h3><div class="docstring">
245
+ <div class="discussion">
246
+
247
+ <p>Include hook for the view</p>
248
+
249
+
250
+ </div>
251
+ </div>
252
+ <div class="tags">
253
+
254
+
255
+ </div><table class="source_code">
256
+ <tr>
257
+ <td>
258
+ <pre class="lines">
259
+
260
+
261
+ 10
262
+ 11
263
+ 12</pre>
264
+ </td>
265
+ <td>
266
+ <pre class="code"><span class="info file"># File 'lib/view_models/helpers/view.rb', line 10</span>
267
+
268
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_included'>included</span> <span class='id identifier rubyid_view_model'>view_model</span>
269
+ <span class='id identifier rubyid_view_model'>view_model</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span> <span class='symbol'>:include</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_all_view_helpers'>all_view_helpers</span>
270
+ <span class='kw'>end</span></pre>
271
+ </td>
272
+ </tr>
273
+ </table>
274
+ </div>
275
+
276
+ </div>
277
+
278
+ </div>
279
+
280
+ <div id="footer">
281
+ Generated on Tue Oct 16 23:27:34 2012 by
282
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
283
+ 0.8.3 (ruby-1.9.3).
284
+ </div>
285
+
286
+ </body>
287
+ </html>
@@ -0,0 +1,745 @@
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
+ Class: ViewModels::PathStore
8
+
9
+ &mdash; 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 (P)</a> &raquo;
35
+ <span class='title'><span class='object_link'><a href="../ViewModels.html" title="ViewModels (module)">ViewModels</a></span></span>
36
+ &raquo;
37
+ <span class="title">PathStore</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>Class: ViewModels::PathStore
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+ <dt class="r1">Inherits:</dt>
75
+ <dd class="r1">
76
+ <span class="inheritName">Object</span>
77
+
78
+ <ul class="fullTree">
79
+ <li>Object</li>
80
+
81
+ <li class="next">ViewModels::PathStore</li>
82
+
83
+ </ul>
84
+ <a href="#" class="inheritanceTree">show all</a>
85
+
86
+ </dd>
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+ <dt class="r2 last">Defined in:</dt>
97
+ <dd class="r2 last">lib/view_models/path_store.rb</dd>
98
+
99
+ </dl>
100
+ <div class="clear"></div>
101
+
102
+ <h2>Overview</h2><div class="docstring">
103
+ <div class="discussion">
104
+
105
+ <p>A simple path store. Designed to remove a bit of complexity from the base
106
+ view model.</p>
107
+
108
+ <p>Use it to install an instance in the metaclass.</p>
109
+
110
+
111
+ </div>
112
+ </div>
113
+ <div class="tags">
114
+
115
+
116
+ </div>
117
+
118
+
119
+
120
+ <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
121
+ <ul class="summary">
122
+
123
+ <li class="public ">
124
+ <span class="summary_signature">
125
+
126
+ <a href="#view_model_class-instance_method" title="#view_model_class (instance method)">- (Object) <strong>view_model_class</strong> </a>
127
+
128
+
129
+
130
+ </span>
131
+
132
+
133
+
134
+
135
+ <span class="note title readonly">readonly</span>
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+ <span class="summary_desc"><div class='inline'>
146
+ <p>The view model class attribute.</p>
147
+ </div></span>
148
+
149
+ </li>
150
+
151
+
152
+ </ul>
153
+
154
+
155
+
156
+
157
+
158
+ <h2>
159
+ Class Method Summary
160
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
161
+ </h2>
162
+
163
+ <ul class="summary">
164
+
165
+ <li class="public ">
166
+ <span class="summary_signature">
167
+
168
+ <a href="#install_in-class_method" title="install_in (class method)">+ (Object) <strong>install_in</strong>(klass) </a>
169
+
170
+
171
+
172
+ </span>
173
+
174
+
175
+
176
+
177
+
178
+
179
+
180
+
181
+
182
+ <span class="summary_desc"><div class='inline'>
183
+ <p>Install in the metaclass (as an example).</p>
184
+ </div></span>
185
+
186
+ </li>
187
+
188
+
189
+ </ul>
190
+
191
+ <h2>
192
+ Instance Method Summary
193
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
194
+ </h2>
195
+
196
+ <ul class="summary">
197
+
198
+ <li class="public ">
199
+ <span class="summary_signature">
200
+
201
+ <a href="#%5B%5D-instance_method" title="#[] (instance method)">- (Object) <strong>[]</strong>(key) </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>Simple [] delegation.</p>
217
+ </div></span>
218
+
219
+ </li>
220
+
221
+
222
+ <li class="public ">
223
+ <span class="summary_signature">
224
+
225
+ <a href="#%5B%5D%3D-instance_method" title="#[]= (instance method)">- (Object) <strong>[]=</strong>(key, path) </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>Does not save values for nil keys.</p>
241
+ </div></span>
242
+
243
+ </li>
244
+
245
+
246
+ <li class="public ">
247
+ <span class="summary_signature">
248
+
249
+ <a href="#cached-instance_method" title="#cached (instance method)">- (Object) <strong>cached</strong>(options, &amp;block) </a>
250
+
251
+
252
+
253
+ </span>
254
+
255
+
256
+
257
+
258
+
259
+
260
+
261
+
262
+
263
+ <span class="summary_desc"><div class='inline'>
264
+ <p>Cache the result of the rendering.</p>
265
+ </div></span>
266
+
267
+ </li>
268
+
269
+
270
+ <li class="public ">
271
+ <span class="summary_signature">
272
+
273
+ <a href="#initialize-instance_method" title="#initialize (instance method)">- (PathStore) <strong>initialize</strong>(view_model_class) </a>
274
+
275
+
276
+
277
+ </span>
278
+
279
+
280
+ <span class="note title constructor">constructor</span>
281
+
282
+
283
+
284
+
285
+
286
+
287
+
288
+
289
+ <span class="summary_desc"><div class='inline'>
290
+ <p>Initialize the path store.</p>
291
+ </div></span>
292
+
293
+ </li>
294
+
295
+
296
+ <li class="public ">
297
+ <span class="summary_signature">
298
+
299
+ <a href="#prepare-instance_method" title="#prepare (instance method)">- (Object) <strong>prepare</strong>(key) </a>
300
+
301
+
302
+
303
+ </span>
304
+
305
+
306
+
307
+
308
+
309
+
310
+
311
+
312
+
313
+ <span class="summary_desc"><div class='inline'>
314
+ <p>Prepare the key for the next storing procedure.</p>
315
+ </div></span>
316
+
317
+ </li>
318
+
319
+
320
+ <li class="public ">
321
+ <span class="summary_signature">
322
+
323
+ <a href="#save-instance_method" title="#save (instance method)">- (Object) <strong>save</strong>(options) </a>
324
+
325
+
326
+
327
+ </span>
328
+
329
+
330
+
331
+
332
+
333
+
334
+
335
+
336
+
337
+ <span class="summary_desc"><div class='inline'>
338
+ <p>Saves the options for the prepared key.</p>
339
+ </div></span>
340
+
341
+ </li>
342
+
343
+
344
+ </ul>
345
+
346
+
347
+ <div id="constructor_details" class="method_details_list">
348
+ <h2>Constructor Details</h2>
349
+
350
+ <div class="method_details first">
351
+ <h3 class="signature first" id="initialize-instance_method">
352
+
353
+ - (<tt><span class='object_link'><a href="" title="ViewModels::PathStore (class)">PathStore</a></span></tt>) <strong>initialize</strong>(view_model_class)
354
+
355
+
356
+
357
+
358
+
359
+ </h3><div class="docstring">
360
+ <div class="discussion">
361
+
362
+ <p>Initialize the path store</p>
363
+
364
+
365
+ </div>
366
+ </div>
367
+ <div class="tags">
368
+ <p class="tag_title">Parameters:</p>
369
+ <ul class="param">
370
+
371
+ <li>
372
+
373
+ <span class='name'>view_model_class</span>
374
+
375
+
376
+ <span class='type'>(<tt>ViewModel</tt>)</span>
377
+
378
+
379
+
380
+ &mdash;
381
+ <div class='inline'>
382
+ <p>The view model class</p>
383
+ </div>
384
+
385
+ </li>
386
+
387
+ </ul>
388
+
389
+
390
+ </div><table class="source_code">
391
+ <tr>
392
+ <td>
393
+ <pre class="lines">
394
+
395
+
396
+ 18
397
+ 19
398
+ 20
399
+ 21</pre>
400
+ </td>
401
+ <td>
402
+ <pre class="code"><span class="info file"># File 'lib/view_models/path_store.rb', line 18</span>
403
+
404
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span> <span class='id identifier rubyid_view_model_class'>view_model_class</span>
405
+ <span class='ivar'>@view_model_class</span> <span class='op'>=</span> <span class='id identifier rubyid_view_model_class'>view_model_class</span>
406
+ <span class='ivar'>@name_path_mapping</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
407
+ <span class='kw'>end</span></pre>
408
+ </td>
409
+ </tr>
410
+ </table>
411
+ </div>
412
+
413
+ </div>
414
+
415
+ <div id="instance_attr_details" class="attr_details">
416
+ <h2>Instance Attribute Details</h2>
417
+
418
+
419
+ <span id=""></span>
420
+ <div class="method_details first">
421
+ <h3 class="signature first" id="view_model_class-instance_method">
422
+
423
+ - (<tt>Object</tt>) <strong>view_model_class</strong> <span class="extras">(readonly)</span>
424
+
425
+
426
+
427
+
428
+
429
+ </h3><div class="docstring">
430
+ <div class="discussion">
431
+
432
+ <p>The view model class attribute</p>
433
+
434
+
435
+ </div>
436
+ </div>
437
+ <div class="tags">
438
+
439
+
440
+ </div><table class="source_code">
441
+ <tr>
442
+ <td>
443
+ <pre class="lines">
444
+
445
+
446
+ 13
447
+ 14
448
+ 15</pre>
449
+ </td>
450
+ <td>
451
+ <pre class="code"><span class="info file"># File 'lib/view_models/path_store.rb', line 13</span>
452
+
453
+ <span class='kw'>def</span> <span class='id identifier rubyid_view_model_class'>view_model_class</span>
454
+ <span class='ivar'>@view_model_class</span>
455
+ <span class='kw'>end</span></pre>
456
+ </td>
457
+ </tr>
458
+ </table>
459
+ </div>
460
+
461
+ </div>
462
+
463
+
464
+ <div id="class_method_details" class="method_details_list">
465
+ <h2>Class Method Details</h2>
466
+
467
+
468
+ <div class="method_details first">
469
+ <h3 class="signature first" id="install_in-class_method">
470
+
471
+ + (<tt>Object</tt>) <strong>install_in</strong>(klass)
472
+
473
+
474
+
475
+
476
+
477
+ </h3><div class="docstring">
478
+ <div class="discussion">
479
+
480
+ <p>Install in the metaclass (as an example).</p>
481
+
482
+
483
+ </div>
484
+ </div>
485
+ <div class="tags">
486
+
487
+
488
+ </div><table class="source_code">
489
+ <tr>
490
+ <td>
491
+ <pre class="lines">
492
+
493
+
494
+ 25
495
+ 26
496
+ 27</pre>
497
+ </td>
498
+ <td>
499
+ <pre class="code"><span class="info file"># File 'lib/view_models/path_store.rb', line 25</span>
500
+
501
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_install_in'>install_in</span> <span class='id identifier rubyid_klass'>klass</span>
502
+ <span class='id identifier rubyid_klass'>klass</span><span class='period'>.</span><span class='id identifier rubyid_path_store'>path_store</span> <span class='op'>=</span> <span class='const'>PathStore</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='id identifier rubyid_klass'>klass</span>
503
+ <span class='kw'>end</span></pre>
504
+ </td>
505
+ </tr>
506
+ </table>
507
+ </div>
508
+
509
+ </div>
510
+
511
+ <div id="instance_method_details" class="method_details_list">
512
+ <h2>Instance Method Details</h2>
513
+
514
+
515
+ <div class="method_details first">
516
+ <h3 class="signature first" id="[]-instance_method">
517
+
518
+ - (<tt>Object</tt>) <strong>[]</strong>(key)
519
+
520
+
521
+
522
+
523
+
524
+ </h3><div class="docstring">
525
+ <div class="discussion">
526
+
527
+ <p>Simple [] delegation.</p>
528
+
529
+
530
+ </div>
531
+ </div>
532
+ <div class="tags">
533
+
534
+
535
+ </div><table class="source_code">
536
+ <tr>
537
+ <td>
538
+ <pre class="lines">
539
+
540
+
541
+ 60
542
+ 61
543
+ 62</pre>
544
+ </td>
545
+ <td>
546
+ <pre class="code"><span class="info file"># File 'lib/view_models/path_store.rb', line 60</span>
547
+
548
+ <span class='kw'>def</span> <span class='op'>[]</span> <span class='id identifier rubyid_key'>key</span>
549
+ <span class='ivar'>@name_path_mapping</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span>
550
+ <span class='kw'>end</span></pre>
551
+ </td>
552
+ </tr>
553
+ </table>
554
+ </div>
555
+
556
+ <div class="method_details ">
557
+ <h3 class="signature " id="[]=-instance_method">
558
+
559
+ - (<tt>Object</tt>) <strong>[]=</strong>(key, path)
560
+
561
+
562
+
563
+
564
+
565
+ </h3><div class="docstring">
566
+ <div class="discussion">
567
+
568
+ <p>Does not save values for nil keys.</p>
569
+
570
+
571
+ </div>
572
+ </div>
573
+ <div class="tags">
574
+
575
+
576
+ </div><table class="source_code">
577
+ <tr>
578
+ <td>
579
+ <pre class="lines">
580
+
581
+
582
+ 53
583
+ 54
584
+ 55
585
+ 56</pre>
586
+ </td>
587
+ <td>
588
+ <pre class="code"><span class="info file"># File 'lib/view_models/path_store.rb', line 53</span>
589
+
590
+ <span class='kw'>def</span> <span class='op'>[]=</span> <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span>
591
+ <span class='kw'>return</span> <span class='kw'>if</span> <span class='id identifier rubyid_key'>key</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
592
+ <span class='ivar'>@name_path_mapping</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span> <span class='op'>||=</span> <span class='id identifier rubyid_path'>path</span>
593
+ <span class='kw'>end</span></pre>
594
+ </td>
595
+ </tr>
596
+ </table>
597
+ </div>
598
+
599
+ <div class="method_details ">
600
+ <h3 class="signature " id="cached-instance_method">
601
+
602
+ - (<tt>Object</tt>) <strong>cached</strong>(options, &amp;block)
603
+
604
+
605
+
606
+
607
+
608
+ </h3><div class="docstring">
609
+ <div class="discussion">
610
+
611
+ <p>Cache the result of the rendering.</p>
612
+
613
+
614
+ </div>
615
+ </div>
616
+ <div class="tags">
617
+
618
+
619
+ </div><table class="source_code">
620
+ <tr>
621
+ <td>
622
+ <pre class="lines">
623
+
624
+
625
+ 31
626
+ 32
627
+ 33
628
+ 34
629
+ 35</pre>
630
+ </td>
631
+ <td>
632
+ <pre class="code"><span class="info file"># File 'lib/view_models/path_store.rb', line 31</span>
633
+
634
+ <span class='kw'>def</span> <span class='id identifier rubyid_cached'>cached</span> <span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span>
635
+ <span class='id identifier rubyid_prepare'>prepare</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_path_key'>path_key</span>
636
+ <span class='id identifier rubyid_result'>result</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span>
637
+ <span class='id identifier rubyid_save'>save</span> <span class='id identifier rubyid_options'>options</span> <span class='kw'>and</span> <span class='id identifier rubyid_result'>result</span> <span class='kw'>if</span> <span class='id identifier rubyid_result'>result</span>
638
+ <span class='kw'>end</span></pre>
639
+ </td>
640
+ </tr>
641
+ </table>
642
+ </div>
643
+
644
+ <div class="method_details ">
645
+ <h3 class="signature " id="prepare-instance_method">
646
+
647
+ - (<tt>Object</tt>) <strong>prepare</strong>(key)
648
+
649
+
650
+
651
+
652
+
653
+ </h3><div class="docstring">
654
+ <div class="discussion">
655
+
656
+ <div class="note notetag">
657
+ <strong>Note:</strong>
658
+ <div class='inline'>
659
+ <p>If this is nil, the store will not save the path.</p>
660
+ </div>
661
+ </div>
662
+
663
+
664
+ <p>Prepare the key for the next storing procedure.</p>
665
+
666
+
667
+ </div>
668
+ </div>
669
+ <div class="tags">
670
+
671
+
672
+ </div><table class="source_code">
673
+ <tr>
674
+ <td>
675
+ <pre class="lines">
676
+
677
+
678
+ 41
679
+ 42
680
+ 43</pre>
681
+ </td>
682
+ <td>
683
+ <pre class="code"><span class="info file"># File 'lib/view_models/path_store.rb', line 41</span>
684
+
685
+ <span class='kw'>def</span> <span class='id identifier rubyid_prepare'>prepare</span> <span class='id identifier rubyid_key'>key</span>
686
+ <span class='ivar'>@key</span> <span class='op'>=</span> <span class='id identifier rubyid_key'>key</span>
687
+ <span class='kw'>end</span></pre>
688
+ </td>
689
+ </tr>
690
+ </table>
691
+ </div>
692
+
693
+ <div class="method_details ">
694
+ <h3 class="signature " id="save-instance_method">
695
+
696
+ - (<tt>Object</tt>) <strong>save</strong>(options)
697
+
698
+
699
+
700
+
701
+
702
+ </h3><div class="docstring">
703
+ <div class="discussion">
704
+
705
+ <p>Saves the options for the prepared key.</p>
706
+
707
+
708
+ </div>
709
+ </div>
710
+ <div class="tags">
711
+
712
+
713
+ </div><table class="source_code">
714
+ <tr>
715
+ <td>
716
+ <pre class="lines">
717
+
718
+
719
+ 47
720
+ 48
721
+ 49</pre>
722
+ </td>
723
+ <td>
724
+ <pre class="code"><span class="info file"># File 'lib/view_models/path_store.rb', line 47</span>
725
+
726
+ <span class='kw'>def</span> <span class='id identifier rubyid_save'>save</span> <span class='id identifier rubyid_options'>options</span>
727
+ <span class='kw'>self</span><span class='lbracket'>[</span><span class='ivar'>@key</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_file'>file</span>
728
+ <span class='kw'>end</span></pre>
729
+ </td>
730
+ </tr>
731
+ </table>
732
+ </div>
733
+
734
+ </div>
735
+
736
+ </div>
737
+
738
+ <div id="footer">
739
+ Generated on Tue Oct 16 23:27:35 2012 by
740
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
741
+ 0.8.3 (ruby-1.9.3).
742
+ </div>
743
+
744
+ </body>
745
+ </html>