view_models 2.0.1 → 3.0.0
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.
- 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,255 @@
|
|
|
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::ModelReader
|
|
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="../Extensions.html" title="ViewModels::Extensions (module)">Extensions</a></span></span>
|
|
36
|
+
»
|
|
37
|
+
<span class="title">ModelReader</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::ModelReader
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
</h1>
|
|
71
|
+
|
|
72
|
+
<dl class="box">
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
<dt class="r1">Included in:</dt>
|
|
81
|
+
<dd class="r1"><span class='object_link'><a href="../Base.html" title="ViewModels::Base (class)">Base</a></span></dd>
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
<dt class="r2 last">Defined in:</dt>
|
|
86
|
+
<dd class="r2 last">lib/view_models/extensions/model_reader.rb</dd>
|
|
87
|
+
|
|
88
|
+
</dl>
|
|
89
|
+
<div class="clear"></div>
|
|
90
|
+
|
|
91
|
+
<h2>Overview</h2><div class="docstring">
|
|
92
|
+
<div class="discussion">
|
|
93
|
+
|
|
94
|
+
<p>Model Reader extension. Allows to define model readers on view models,
|
|
95
|
+
accessing attributes and methods on models</p>
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
<div class="tags">
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
</div><h2>Defined Under Namespace</h2>
|
|
104
|
+
<p class="children">
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="ModelReader/FilteredDelegationInstaller.html" title="ViewModels::Extensions::ModelReader::FilteredDelegationInstaller (class)">FilteredDelegationInstaller</a></span>, <span class='object_link'><a href="ModelReader/Options.html" title="ViewModels::Extensions::ModelReader::Options (class)">Options</a></span>
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
</p>
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
<h2>
|
|
122
|
+
Instance Method Summary
|
|
123
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
|
124
|
+
</h2>
|
|
125
|
+
|
|
126
|
+
<ul class="summary">
|
|
127
|
+
|
|
128
|
+
<li class="public ">
|
|
129
|
+
<span class="summary_signature">
|
|
130
|
+
|
|
131
|
+
<a href="#model_reader-instance_method" title="#model_reader (instance method)">- (Object) <strong>model_reader</strong>(*attributes_and_options) </a>
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
</span>
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
<span class="summary_desc"><div class='inline'>
|
|
146
|
+
<p>Define a reader for a model attribute.</p>
|
|
147
|
+
</div></span>
|
|
148
|
+
|
|
149
|
+
</li>
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
</ul>
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
<div id="instance_method_details" class="method_details_list">
|
|
158
|
+
<h2>Instance Method Details</h2>
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
<div class="method_details first">
|
|
162
|
+
<h3 class="signature first" id="model_reader-instance_method">
|
|
163
|
+
|
|
164
|
+
- (<tt>Object</tt>) <strong>model_reader</strong>(*attributes_and_options)
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
</h3><div class="docstring">
|
|
171
|
+
<div class="discussion">
|
|
172
|
+
|
|
173
|
+
<p>Define a reader for a model attribute. Acts as a filtered delegation to the
|
|
174
|
+
model.</p>
|
|
175
|
+
|
|
176
|
+
<p>You may specify a :filter_through option that is either a symbol or an
|
|
177
|
+
array of symbols. The return value from the model will be filtered through
|
|
178
|
+
the functions (arity 1) and then passed back to the receiver.</p>
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
</div>
|
|
182
|
+
</div>
|
|
183
|
+
<div class="tags">
|
|
184
|
+
|
|
185
|
+
<div class="examples">
|
|
186
|
+
<p class="tag_title">Examples:</p>
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
<p class="example_title"><div class='inline'>
|
|
190
|
+
<p>install different model readers</p>
|
|
191
|
+
</div></p>
|
|
192
|
+
|
|
193
|
+
<pre class="example code">
|
|
194
|
+
<span class='id identifier rubyid_model_reader'>model_reader</span> <span class='symbol'>:foobar</span> <span class='comment'># same as delegate :foobar, :to => :model
|
|
195
|
+
</span><span class='id identifier rubyid_model_reader'>model_reader</span> <span class='symbol'>:foobar</span><span class='comma'>,</span> <span class='symbol'>:filter_through</span> <span class='op'>=></span> <span class='symbol'>:h</span> <span class='comment'># html escape foobar
|
|
196
|
+
</span><span class='id identifier rubyid_model_reader'>model_reader</span> <span class='symbol'>:foobar</span><span class='comma'>,</span> <span class='symbol'>:filter_through</span> <span class='op'>=></span> <span class='lbracket'>[</span><span class='symbol'>:textilize</span><span class='comma'>,</span> <span class='symbol'>:h</span><span class='rbracket'>]</span> <span class='comment'># first textilize, then html escape</span></pre>
|
|
197
|
+
|
|
198
|
+
</div>
|
|
199
|
+
<p class="tag_title">Parameters:</p>
|
|
200
|
+
<ul class="param">
|
|
201
|
+
|
|
202
|
+
<li>
|
|
203
|
+
|
|
204
|
+
<span class='name'>attributes_and_options</span>
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
<span class='type'>(<tt>Symbol</tt>, <tt>Hash</tt>)</span>
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
—
|
|
212
|
+
<div class='inline'>
|
|
213
|
+
<p>The attributes and options for the model reader</p>
|
|
214
|
+
</div>
|
|
215
|
+
|
|
216
|
+
</li>
|
|
217
|
+
|
|
218
|
+
</ul>
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
</div><table class="source_code">
|
|
222
|
+
<tr>
|
|
223
|
+
<td>
|
|
224
|
+
<pre class="lines">
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
27
|
|
228
|
+
28
|
|
229
|
+
29
|
|
230
|
+
30</pre>
|
|
231
|
+
</td>
|
|
232
|
+
<td>
|
|
233
|
+
<pre class="code"><span class="info file"># File 'lib/view_models/extensions/model_reader.rb', line 27</span>
|
|
234
|
+
|
|
235
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_model_reader'>model_reader</span> <span class='op'>*</span><span class='id identifier rubyid_attributes_and_options'>attributes_and_options</span>
|
|
236
|
+
<span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='const'>Options</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span> <span class='op'>*</span><span class='id identifier rubyid_attributes_and_options'>attributes_and_options</span>
|
|
237
|
+
<span class='const'>FilteredDelegationInstaller</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='kw'>self</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_install'>install</span>
|
|
238
|
+
<span class='kw'>end</span></pre>
|
|
239
|
+
</td>
|
|
240
|
+
</tr>
|
|
241
|
+
</table>
|
|
242
|
+
</div>
|
|
243
|
+
|
|
244
|
+
</div>
|
|
245
|
+
|
|
246
|
+
</div>
|
|
247
|
+
|
|
248
|
+
<div id="footer">
|
|
249
|
+
Generated on Tue Oct 16 23:27:34 2012 by
|
|
250
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
251
|
+
0.8.3 (ruby-1.9.3).
|
|
252
|
+
</div>
|
|
253
|
+
|
|
254
|
+
</body>
|
|
255
|
+
</html>
|
|
@@ -0,0 +1,908 @@
|
|
|
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::Extensions::ModelReader::FilteredDelegationInstaller
|
|
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 (F)</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> » <span class='title'><span class='object_link'><a href="../ModelReader.html" title="ViewModels::Extensions::ModelReader (module)">ModelReader</a></span></span>
|
|
36
|
+
»
|
|
37
|
+
<span class="title">FilteredDelegationInstaller</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::Extensions::ModelReader::FilteredDelegationInstaller
|
|
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::Extensions::ModelReader::FilteredDelegationInstaller</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/extensions/model_reader.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>The filtered delegation installer installs delegators on the target that
|
|
106
|
+
are filtered.</p>
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
<div class="tags">
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
</div>
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
|
119
|
+
<ul class="summary">
|
|
120
|
+
|
|
121
|
+
<li class="public ">
|
|
122
|
+
<span class="summary_signature">
|
|
123
|
+
|
|
124
|
+
<a href="#attributes-instance_method" title="#attributes (instance method)">- (Object) <strong>attributes</strong> </a>
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
</span>
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
<span class="note title readonly">readonly</span>
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
<span class="summary_desc"><div class='inline'>
|
|
144
|
+
<p>The attributes target, attributes, filters.</p>
|
|
145
|
+
</div></span>
|
|
146
|
+
|
|
147
|
+
</li>
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
<li class="public ">
|
|
151
|
+
<span class="summary_signature">
|
|
152
|
+
|
|
153
|
+
<a href="#filters-instance_method" title="#filters (instance method)">- (Object) <strong>filters</strong> </a>
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
</span>
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
<span class="note title readonly">readonly</span>
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
<span class="summary_desc"><div class='inline'>
|
|
173
|
+
<p>The attributes target, attributes, filters.</p>
|
|
174
|
+
</div></span>
|
|
175
|
+
|
|
176
|
+
</li>
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
<li class="public ">
|
|
180
|
+
<span class="summary_signature">
|
|
181
|
+
|
|
182
|
+
<a href="#target-instance_method" title="#target (instance method)">- (Object) <strong>target</strong> </a>
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
</span>
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
<span class="note title readonly">readonly</span>
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
<span class="summary_desc"><div class='inline'>
|
|
202
|
+
<p>The attributes target, attributes, filters.</p>
|
|
203
|
+
</div></span>
|
|
204
|
+
|
|
205
|
+
</li>
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
</ul>
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
<h2>
|
|
215
|
+
Instance Method Summary
|
|
216
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
|
217
|
+
</h2>
|
|
218
|
+
|
|
219
|
+
<ul class="summary">
|
|
220
|
+
|
|
221
|
+
<li class="public ">
|
|
222
|
+
<span class="summary_signature">
|
|
223
|
+
|
|
224
|
+
<a href="#filtered_left_parentheses-instance_method" title="#filtered_left_parentheses (instance method)">- (Object) <strong>filtered_left_parentheses</strong> </a>
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
</span>
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
<span class="summary_desc"><div class='inline'>
|
|
239
|
+
<p>Combines left parentheses and filters.</p>
|
|
240
|
+
</div></span>
|
|
241
|
+
|
|
242
|
+
</li>
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
<li class="public ">
|
|
246
|
+
<span class="summary_signature">
|
|
247
|
+
|
|
248
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (FilteredDelegationInstaller) <strong>initialize</strong>(target, options) </a>
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
</span>
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
<span class="note title constructor">constructor</span>
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
<span class="summary_desc"><div class='inline'>
|
|
265
|
+
<p>Initialize a new filtered delegation.</p>
|
|
266
|
+
</div></span>
|
|
267
|
+
|
|
268
|
+
</li>
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
<li class="public ">
|
|
272
|
+
<span class="summary_signature">
|
|
273
|
+
|
|
274
|
+
<a href="#install-instance_method" title="#install (instance method)">- (Object) <strong>install</strong> </a>
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
</span>
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
<span class="summary_desc"><div class='inline'>
|
|
289
|
+
<p>Install a reader for each attribute.</p>
|
|
290
|
+
</div></span>
|
|
291
|
+
|
|
292
|
+
</li>
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
<li class="public ">
|
|
296
|
+
<span class="summary_signature">
|
|
297
|
+
|
|
298
|
+
<a href="#install_reader-instance_method" title="#install_reader (instance method)">- (Object) <strong>install_reader</strong>(attribute) </a>
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
</span>
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
<span class="summary_desc"><div class='inline'>
|
|
313
|
+
<p>Install a reader for the given name with the given filters.</p>
|
|
314
|
+
</div></span>
|
|
315
|
+
|
|
316
|
+
</li>
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
<li class="public ">
|
|
320
|
+
<span class="summary_signature">
|
|
321
|
+
|
|
322
|
+
<a href="#left_parentheses-instance_method" title="#left_parentheses (instance method)">- (Object) <strong>left_parentheses</strong> </a>
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
</span>
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
<span class="summary_desc"><div class='inline'>
|
|
337
|
+
<p>Generates an array of left parentheses with length <amount of
|
|
338
|
+
filters>.</p>
|
|
339
|
+
</div></span>
|
|
340
|
+
|
|
341
|
+
</li>
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
<li class="public ">
|
|
345
|
+
<span class="summary_signature">
|
|
346
|
+
|
|
347
|
+
<a href="#reader_definition_for-instance_method" title="#reader_definition_for (instance method)">- (Object) <strong>reader_definition_for</strong>(attribute) </a>
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
</span>
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
<span class="summary_desc"><div class='inline'>
|
|
362
|
+
<p>Defines a reader for the given model attribute and filtering through the
|
|
363
|
+
given filters.</p>
|
|
364
|
+
</div></span>
|
|
365
|
+
|
|
366
|
+
</li>
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
<li class="public ">
|
|
370
|
+
<span class="summary_signature">
|
|
371
|
+
|
|
372
|
+
<a href="#right_parentheses-instance_method" title="#right_parentheses (instance method)">- (Object) <strong>right_parentheses</strong> </a>
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
</span>
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
<span class="summary_desc"><div class='inline'>
|
|
387
|
+
<p>Generates the needed amount of parentheses to match the left parentheses.</p>
|
|
388
|
+
</div></span>
|
|
389
|
+
|
|
390
|
+
</li>
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
</ul>
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
<div id="constructor_details" class="method_details_list">
|
|
397
|
+
<h2>Constructor Details</h2>
|
|
398
|
+
|
|
399
|
+
<div class="method_details first">
|
|
400
|
+
<h3 class="signature first" id="initialize-instance_method">
|
|
401
|
+
|
|
402
|
+
- (<tt><span class='object_link'><a href="" title="ViewModels::Extensions::ModelReader::FilteredDelegationInstaller (class)">FilteredDelegationInstaller</a></span></tt>) <strong>initialize</strong>(target, options)
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
</h3><div class="docstring">
|
|
409
|
+
<div class="discussion">
|
|
410
|
+
|
|
411
|
+
<p>Initialize a new filtered delegation</p>
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
</div>
|
|
415
|
+
</div>
|
|
416
|
+
<div class="tags">
|
|
417
|
+
<p class="tag_title">Parameters:</p>
|
|
418
|
+
<ul class="param">
|
|
419
|
+
|
|
420
|
+
<li>
|
|
421
|
+
|
|
422
|
+
<span class='name'>target</span>
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
<span class='type'>(<tt>ViewModel</tt>)</span>
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
—
|
|
430
|
+
<div class='inline'>
|
|
431
|
+
<p>the target to install the filtered delegation in</p>
|
|
432
|
+
</div>
|
|
433
|
+
|
|
434
|
+
</li>
|
|
435
|
+
|
|
436
|
+
<li>
|
|
437
|
+
|
|
438
|
+
<span class='name'>options</span>
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
<span class='type'>(<tt><span class='object_link'><a href="Options.html" title="ViewModels::Extensions::ModelReader::Options (class)">ModelReader::Options</a></span></tt>)</span>
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
—
|
|
446
|
+
<div class='inline'>
|
|
447
|
+
<p>The options for the filtered delegation</p>
|
|
448
|
+
</div>
|
|
449
|
+
|
|
450
|
+
</li>
|
|
451
|
+
|
|
452
|
+
</ul>
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
</div><table class="source_code">
|
|
456
|
+
<tr>
|
|
457
|
+
<td>
|
|
458
|
+
<pre class="lines">
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
76
|
|
462
|
+
77
|
|
463
|
+
78</pre>
|
|
464
|
+
</td>
|
|
465
|
+
<td>
|
|
466
|
+
<pre class="code"><span class="info file"># File 'lib/view_models/extensions/model_reader.rb', line 76</span>
|
|
467
|
+
|
|
468
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span> <span class='id identifier rubyid_target'>target</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span>
|
|
469
|
+
<span class='ivar'>@target</span><span class='comma'>,</span> <span class='ivar'>@attributes</span><span class='comma'>,</span> <span class='ivar'>@filters</span> <span class='op'>=</span> <span class='id identifier rubyid_target'>target</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_options'>options</span>
|
|
470
|
+
<span class='kw'>end</span></pre>
|
|
471
|
+
</td>
|
|
472
|
+
</tr>
|
|
473
|
+
</table>
|
|
474
|
+
</div>
|
|
475
|
+
|
|
476
|
+
</div>
|
|
477
|
+
|
|
478
|
+
<div id="instance_attr_details" class="attr_details">
|
|
479
|
+
<h2>Instance Attribute Details</h2>
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
<span id=""></span>
|
|
483
|
+
<div class="method_details first">
|
|
484
|
+
<h3 class="signature first" id="attributes-instance_method">
|
|
485
|
+
|
|
486
|
+
- (<tt>Object</tt>) <strong>attributes</strong> <span class="extras">(readonly)</span>
|
|
487
|
+
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
|
|
491
|
+
|
|
492
|
+
</h3><div class="docstring">
|
|
493
|
+
<div class="discussion">
|
|
494
|
+
|
|
495
|
+
<p>The attributes target, attributes, filters</p>
|
|
496
|
+
|
|
497
|
+
|
|
498
|
+
</div>
|
|
499
|
+
</div>
|
|
500
|
+
<div class="tags">
|
|
501
|
+
|
|
502
|
+
|
|
503
|
+
</div><table class="source_code">
|
|
504
|
+
<tr>
|
|
505
|
+
<td>
|
|
506
|
+
<pre class="lines">
|
|
507
|
+
|
|
508
|
+
|
|
509
|
+
70
|
|
510
|
+
71
|
|
511
|
+
72</pre>
|
|
512
|
+
</td>
|
|
513
|
+
<td>
|
|
514
|
+
<pre class="code"><span class="info file"># File 'lib/view_models/extensions/model_reader.rb', line 70</span>
|
|
515
|
+
|
|
516
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_attributes'>attributes</span>
|
|
517
|
+
<span class='ivar'>@attributes</span>
|
|
518
|
+
<span class='kw'>end</span></pre>
|
|
519
|
+
</td>
|
|
520
|
+
</tr>
|
|
521
|
+
</table>
|
|
522
|
+
</div>
|
|
523
|
+
|
|
524
|
+
|
|
525
|
+
<span id=""></span>
|
|
526
|
+
<div class="method_details ">
|
|
527
|
+
<h3 class="signature " id="filters-instance_method">
|
|
528
|
+
|
|
529
|
+
- (<tt>Object</tt>) <strong>filters</strong> <span class="extras">(readonly)</span>
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
|
|
533
|
+
|
|
534
|
+
|
|
535
|
+
</h3><div class="docstring">
|
|
536
|
+
<div class="discussion">
|
|
537
|
+
|
|
538
|
+
<p>The attributes target, attributes, filters</p>
|
|
539
|
+
|
|
540
|
+
|
|
541
|
+
</div>
|
|
542
|
+
</div>
|
|
543
|
+
<div class="tags">
|
|
544
|
+
|
|
545
|
+
|
|
546
|
+
</div><table class="source_code">
|
|
547
|
+
<tr>
|
|
548
|
+
<td>
|
|
549
|
+
<pre class="lines">
|
|
550
|
+
|
|
551
|
+
|
|
552
|
+
70
|
|
553
|
+
71
|
|
554
|
+
72</pre>
|
|
555
|
+
</td>
|
|
556
|
+
<td>
|
|
557
|
+
<pre class="code"><span class="info file"># File 'lib/view_models/extensions/model_reader.rb', line 70</span>
|
|
558
|
+
|
|
559
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_filters'>filters</span>
|
|
560
|
+
<span class='ivar'>@filters</span>
|
|
561
|
+
<span class='kw'>end</span></pre>
|
|
562
|
+
</td>
|
|
563
|
+
</tr>
|
|
564
|
+
</table>
|
|
565
|
+
</div>
|
|
566
|
+
|
|
567
|
+
|
|
568
|
+
<span id=""></span>
|
|
569
|
+
<div class="method_details ">
|
|
570
|
+
<h3 class="signature " id="target-instance_method">
|
|
571
|
+
|
|
572
|
+
- (<tt>Object</tt>) <strong>target</strong> <span class="extras">(readonly)</span>
|
|
573
|
+
|
|
574
|
+
|
|
575
|
+
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
</h3><div class="docstring">
|
|
579
|
+
<div class="discussion">
|
|
580
|
+
|
|
581
|
+
<p>The attributes target, attributes, filters</p>
|
|
582
|
+
|
|
583
|
+
|
|
584
|
+
</div>
|
|
585
|
+
</div>
|
|
586
|
+
<div class="tags">
|
|
587
|
+
|
|
588
|
+
|
|
589
|
+
</div><table class="source_code">
|
|
590
|
+
<tr>
|
|
591
|
+
<td>
|
|
592
|
+
<pre class="lines">
|
|
593
|
+
|
|
594
|
+
|
|
595
|
+
70
|
|
596
|
+
71
|
|
597
|
+
72</pre>
|
|
598
|
+
</td>
|
|
599
|
+
<td>
|
|
600
|
+
<pre class="code"><span class="info file"># File 'lib/view_models/extensions/model_reader.rb', line 70</span>
|
|
601
|
+
|
|
602
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_target'>target</span>
|
|
603
|
+
<span class='ivar'>@target</span>
|
|
604
|
+
<span class='kw'>end</span></pre>
|
|
605
|
+
</td>
|
|
606
|
+
</tr>
|
|
607
|
+
</table>
|
|
608
|
+
</div>
|
|
609
|
+
|
|
610
|
+
</div>
|
|
611
|
+
|
|
612
|
+
|
|
613
|
+
<div id="instance_method_details" class="method_details_list">
|
|
614
|
+
<h2>Instance Method Details</h2>
|
|
615
|
+
|
|
616
|
+
|
|
617
|
+
<div class="method_details first">
|
|
618
|
+
<h3 class="signature first" id="filtered_left_parentheses-instance_method">
|
|
619
|
+
|
|
620
|
+
- (<tt>Object</tt>) <strong>filtered_left_parentheses</strong>
|
|
621
|
+
|
|
622
|
+
|
|
623
|
+
|
|
624
|
+
|
|
625
|
+
|
|
626
|
+
</h3><div class="docstring">
|
|
627
|
+
<div class="discussion">
|
|
628
|
+
|
|
629
|
+
<p>Combines left parentheses and filters.</p>
|
|
630
|
+
|
|
631
|
+
|
|
632
|
+
</div>
|
|
633
|
+
</div>
|
|
634
|
+
<div class="tags">
|
|
635
|
+
|
|
636
|
+
|
|
637
|
+
</div><table class="source_code">
|
|
638
|
+
<tr>
|
|
639
|
+
<td>
|
|
640
|
+
<pre class="lines">
|
|
641
|
+
|
|
642
|
+
|
|
643
|
+
106
|
|
644
|
+
107
|
|
645
|
+
108</pre>
|
|
646
|
+
</td>
|
|
647
|
+
<td>
|
|
648
|
+
<pre class="code"><span class="info file"># File 'lib/view_models/extensions/model_reader.rb', line 106</span>
|
|
649
|
+
|
|
650
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_filtered_left_parentheses'>filtered_left_parentheses</span>
|
|
651
|
+
<span class='id identifier rubyid_filters'>filters</span><span class='period'>.</span><span class='id identifier rubyid_zip'>zip</span><span class='lparen'>(</span><span class='id identifier rubyid_left_parentheses'>left_parentheses</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span>
|
|
652
|
+
<span class='kw'>end</span></pre>
|
|
653
|
+
</td>
|
|
654
|
+
</tr>
|
|
655
|
+
</table>
|
|
656
|
+
</div>
|
|
657
|
+
|
|
658
|
+
<div class="method_details ">
|
|
659
|
+
<h3 class="signature " id="install-instance_method">
|
|
660
|
+
|
|
661
|
+
- (<tt>Object</tt>) <strong>install</strong>
|
|
662
|
+
|
|
663
|
+
|
|
664
|
+
|
|
665
|
+
|
|
666
|
+
|
|
667
|
+
</h3><div class="docstring">
|
|
668
|
+
<div class="discussion">
|
|
669
|
+
|
|
670
|
+
<p>Install a reader for each attribute</p>
|
|
671
|
+
|
|
672
|
+
|
|
673
|
+
</div>
|
|
674
|
+
</div>
|
|
675
|
+
<div class="tags">
|
|
676
|
+
|
|
677
|
+
|
|
678
|
+
</div><table class="source_code">
|
|
679
|
+
<tr>
|
|
680
|
+
<td>
|
|
681
|
+
<pre class="lines">
|
|
682
|
+
|
|
683
|
+
|
|
684
|
+
82
|
|
685
|
+
83
|
|
686
|
+
84</pre>
|
|
687
|
+
</td>
|
|
688
|
+
<td>
|
|
689
|
+
<pre class="code"><span class="info file"># File 'lib/view_models/extensions/model_reader.rb', line 82</span>
|
|
690
|
+
|
|
691
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_install'>install</span>
|
|
692
|
+
<span class='id identifier rubyid_attributes'>attributes</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_attribute'>attribute</span><span class='op'>|</span> <span class='id identifier rubyid_install_reader'>install_reader</span><span class='lparen'>(</span><span class='id identifier rubyid_attribute'>attribute</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
|
693
|
+
<span class='kw'>end</span></pre>
|
|
694
|
+
</td>
|
|
695
|
+
</tr>
|
|
696
|
+
</table>
|
|
697
|
+
</div>
|
|
698
|
+
|
|
699
|
+
<div class="method_details ">
|
|
700
|
+
<h3 class="signature " id="install_reader-instance_method">
|
|
701
|
+
|
|
702
|
+
- (<tt>Object</tt>) <strong>install_reader</strong>(attribute)
|
|
703
|
+
|
|
704
|
+
|
|
705
|
+
|
|
706
|
+
|
|
707
|
+
|
|
708
|
+
</h3><div class="docstring">
|
|
709
|
+
<div class="discussion">
|
|
710
|
+
|
|
711
|
+
<p>Install a reader for the given name with the given filters.</p>
|
|
712
|
+
|
|
713
|
+
|
|
714
|
+
</div>
|
|
715
|
+
</div>
|
|
716
|
+
<div class="tags">
|
|
717
|
+
|
|
718
|
+
<div class="examples">
|
|
719
|
+
<p class="tag_title">Examples:</p>
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
<p class="example_title"><div class='inline'>
|
|
723
|
+
<p>Installs a reader for model.attribute</p>
|
|
724
|
+
</div></p>
|
|
725
|
+
|
|
726
|
+
<pre class="example code"><span class='id identifier rubyid_install_reader'>install_reader</span> <span class='symbol'>:attribute</span></pre>
|
|
727
|
+
|
|
728
|
+
</div>
|
|
729
|
+
|
|
730
|
+
|
|
731
|
+
</div><table class="source_code">
|
|
732
|
+
<tr>
|
|
733
|
+
<td>
|
|
734
|
+
<pre class="lines">
|
|
735
|
+
|
|
736
|
+
|
|
737
|
+
91
|
|
738
|
+
92
|
|
739
|
+
93</pre>
|
|
740
|
+
</td>
|
|
741
|
+
<td>
|
|
742
|
+
<pre class="code"><span class="info file"># File 'lib/view_models/extensions/model_reader.rb', line 91</span>
|
|
743
|
+
|
|
744
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_install_reader'>install_reader</span> <span class='id identifier rubyid_attribute'>attribute</span>
|
|
745
|
+
<span class='id identifier rubyid_target'>target</span><span class='period'>.</span><span class='id identifier rubyid_class_eval'>class_eval</span> <span class='id identifier rubyid_reader_definition_for'>reader_definition_for</span><span class='lparen'>(</span><span class='id identifier rubyid_attribute'>attribute</span><span class='rparen'>)</span>
|
|
746
|
+
<span class='kw'>end</span></pre>
|
|
747
|
+
</td>
|
|
748
|
+
</tr>
|
|
749
|
+
</table>
|
|
750
|
+
</div>
|
|
751
|
+
|
|
752
|
+
<div class="method_details ">
|
|
753
|
+
<h3 class="signature " id="left_parentheses-instance_method">
|
|
754
|
+
|
|
755
|
+
- (<tt>Object</tt>) <strong>left_parentheses</strong>
|
|
756
|
+
|
|
757
|
+
|
|
758
|
+
|
|
759
|
+
|
|
760
|
+
|
|
761
|
+
</h3><div class="docstring">
|
|
762
|
+
<div class="discussion">
|
|
763
|
+
|
|
764
|
+
<p>Generates an array of left parentheses with length <amount of
|
|
765
|
+
filters></p>
|
|
766
|
+
|
|
767
|
+
|
|
768
|
+
</div>
|
|
769
|
+
</div>
|
|
770
|
+
<div class="tags">
|
|
771
|
+
|
|
772
|
+
<div class="examples">
|
|
773
|
+
<p class="tag_title">Examples:</p>
|
|
774
|
+
|
|
775
|
+
|
|
776
|
+
<p class="example_title"><div class='inline'>
|
|
777
|
+
<p>for 4 Filters</p>
|
|
778
|
+
</div></p>
|
|
779
|
+
|
|
780
|
+
<pre class="example code"><span class='id identifier rubyid_left_parentheses'>left_parentheses</span> <span class='comment'># => ['(', '(', '(', '(']</span></pre>
|
|
781
|
+
|
|
782
|
+
</div>
|
|
783
|
+
|
|
784
|
+
|
|
785
|
+
</div><table class="source_code">
|
|
786
|
+
<tr>
|
|
787
|
+
<td>
|
|
788
|
+
<pre class="lines">
|
|
789
|
+
|
|
790
|
+
|
|
791
|
+
121
|
|
792
|
+
122
|
|
793
|
+
123</pre>
|
|
794
|
+
</td>
|
|
795
|
+
<td>
|
|
796
|
+
<pre class="code"><span class="info file"># File 'lib/view_models/extensions/model_reader.rb', line 121</span>
|
|
797
|
+
|
|
798
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_left_parentheses'>left_parentheses</span>
|
|
799
|
+
<span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>(</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>*</span> <span class='id identifier rubyid_filters'>filters</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span>
|
|
800
|
+
<span class='kw'>end</span></pre>
|
|
801
|
+
</td>
|
|
802
|
+
</tr>
|
|
803
|
+
</table>
|
|
804
|
+
</div>
|
|
805
|
+
|
|
806
|
+
<div class="method_details ">
|
|
807
|
+
<h3 class="signature " id="reader_definition_for-instance_method">
|
|
808
|
+
|
|
809
|
+
- (<tt>Object</tt>) <strong>reader_definition_for</strong>(attribute)
|
|
810
|
+
|
|
811
|
+
|
|
812
|
+
|
|
813
|
+
|
|
814
|
+
|
|
815
|
+
</h3><div class="docstring">
|
|
816
|
+
<div class="discussion">
|
|
817
|
+
|
|
818
|
+
<div class="note notetag">
|
|
819
|
+
<strong>Note:</strong>
|
|
820
|
+
<div class='inline'>
|
|
821
|
+
<p>The filters are applied from last to first element.</p>
|
|
822
|
+
</div>
|
|
823
|
+
</div>
|
|
824
|
+
|
|
825
|
+
|
|
826
|
+
<p>Defines a reader for the given model attribute and filtering through the
|
|
827
|
+
given filters.</p>
|
|
828
|
+
|
|
829
|
+
|
|
830
|
+
</div>
|
|
831
|
+
</div>
|
|
832
|
+
<div class="tags">
|
|
833
|
+
|
|
834
|
+
|
|
835
|
+
</div><table class="source_code">
|
|
836
|
+
<tr>
|
|
837
|
+
<td>
|
|
838
|
+
<pre class="lines">
|
|
839
|
+
|
|
840
|
+
|
|
841
|
+
100
|
|
842
|
+
101
|
|
843
|
+
102</pre>
|
|
844
|
+
</td>
|
|
845
|
+
<td>
|
|
846
|
+
<pre class="code"><span class="info file"># File 'lib/view_models/extensions/model_reader.rb', line 100</span>
|
|
847
|
+
|
|
848
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_reader_definition_for'>reader_definition_for</span> <span class='id identifier rubyid_attribute'>attribute</span>
|
|
849
|
+
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>def </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_attribute'>attribute</span><span class='rbrace'>}</span><span class='tstring_content'>; </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_filtered_left_parentheses'>filtered_left_parentheses</span><span class='rbrace'>}</span><span class='tstring_content'>model.</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_attribute'>attribute</span><span class='rbrace'>}</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_right_parentheses'>right_parentheses</span><span class='rbrace'>}</span><span class='tstring_content'>; end</span><span class='tstring_end'>"</span></span>
|
|
850
|
+
<span class='kw'>end</span></pre>
|
|
851
|
+
</td>
|
|
852
|
+
</tr>
|
|
853
|
+
</table>
|
|
854
|
+
</div>
|
|
855
|
+
|
|
856
|
+
<div class="method_details ">
|
|
857
|
+
<h3 class="signature " id="right_parentheses-instance_method">
|
|
858
|
+
|
|
859
|
+
- (<tt>Object</tt>) <strong>right_parentheses</strong>
|
|
860
|
+
|
|
861
|
+
|
|
862
|
+
|
|
863
|
+
|
|
864
|
+
|
|
865
|
+
</h3><div class="docstring">
|
|
866
|
+
<div class="discussion">
|
|
867
|
+
|
|
868
|
+
<p>Generates the needed amount of parentheses to match the left parentheses.</p>
|
|
869
|
+
|
|
870
|
+
|
|
871
|
+
</div>
|
|
872
|
+
</div>
|
|
873
|
+
<div class="tags">
|
|
874
|
+
|
|
875
|
+
|
|
876
|
+
</div><table class="source_code">
|
|
877
|
+
<tr>
|
|
878
|
+
<td>
|
|
879
|
+
<pre class="lines">
|
|
880
|
+
|
|
881
|
+
|
|
882
|
+
112
|
|
883
|
+
113
|
|
884
|
+
114</pre>
|
|
885
|
+
</td>
|
|
886
|
+
<td>
|
|
887
|
+
<pre class="code"><span class="info file"># File 'lib/view_models/extensions/model_reader.rb', line 112</span>
|
|
888
|
+
|
|
889
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_right_parentheses'>right_parentheses</span>
|
|
890
|
+
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>)</span><span class='tstring_end'>'</span></span> <span class='op'>*</span> <span class='id identifier rubyid_filters'>filters</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span>
|
|
891
|
+
<span class='kw'>end</span></pre>
|
|
892
|
+
</td>
|
|
893
|
+
</tr>
|
|
894
|
+
</table>
|
|
895
|
+
</div>
|
|
896
|
+
|
|
897
|
+
</div>
|
|
898
|
+
|
|
899
|
+
</div>
|
|
900
|
+
|
|
901
|
+
<div id="footer">
|
|
902
|
+
Generated on Tue Oct 16 23:27:35 2012 by
|
|
903
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
904
|
+
0.8.3 (ruby-1.9.3).
|
|
905
|
+
</div>
|
|
906
|
+
|
|
907
|
+
</body>
|
|
908
|
+
</html>
|