mack-data_factory 0.6.1.2 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +22 -23
- data/doc/classes/Kernel.html +15 -15
- data/doc/classes/Mack.html +0 -6
- data/doc/classes/Mack/Data/Bridge.html +36 -36
- data/doc/classes/Mack/Data/Factory/ClassMethods.html +44 -16
- data/doc/classes/Mack/Data/Factory/FieldContentGenerator.html +324 -305
- data/doc/classes/Mack/Data/Field.html +81 -77
- data/doc/classes/Mack/Data/FieldMgr.html +23 -23
- data/doc/classes/Mack/Data/OrmBridge/ActiveRecord.html +36 -36
- data/doc/classes/Mack/Data/OrmBridge/DataMapper.html +36 -36
- data/doc/classes/Mack/Data/OrmBridge/Default.html +45 -45
- data/doc/created.rid +1 -1
- data/doc/files/README.html +1 -1
- data/doc/files/lib/mack-data_factory/content_generator_rb.html +8 -1
- data/doc/files/lib/mack-data_factory/core_extensions/kernel_rb.html +1 -1
- data/doc/files/lib/mack-data_factory/data_factory_rb.html +1 -1
- data/doc/files/lib/mack-data_factory/field_manager_rb.html +1 -1
- data/doc/files/lib/mack-data_factory/field_rb.html +1 -1
- data/doc/files/lib/mack-data_factory/orm_api_bridge/bridge_rb.html +1 -1
- data/doc/files/lib/mack-data_factory/orm_api_bridge/orm/default_rb.html +1 -1
- data/doc/fr_class_index.html +0 -5
- data/doc/fr_method_index.html +50 -49
- data/lib/mack-data_factory/content_generator.rb +22 -7
- data/lib/mack-data_factory/core_extensions/kernel.rb +1 -1
- data/lib/mack-data_factory/data_factory.rb +11 -4
- data/lib/mack-data_factory/field.rb +18 -14
- data/lib/mack-data_factory/field_manager.rb +3 -3
- data/lib/mack-data_factory/orm_api_bridge/bridge.rb +1 -1
- data/lib/mack-data_factory/orm_api_bridge/orm/default.rb +18 -18
- metadata +2 -2
@@ -86,23 +86,23 @@
|
|
86
86
|
<h3 class="section-bar">Methods</h3>
|
87
87
|
|
88
88
|
<div class="name-list">
|
89
|
-
<a href="#
|
90
|
-
<a href="#
|
91
|
-
<a href="#
|
92
|
-
<a href="#
|
93
|
-
<a href="#
|
94
|
-
<a href="#
|
95
|
-
<a href="#
|
96
|
-
<a href="#
|
97
|
-
<a href="#
|
98
|
-
<a href="#
|
99
|
-
<a href="#
|
100
|
-
<a href="#
|
101
|
-
<a href="#
|
102
|
-
<a href="#M000020">
|
103
|
-
<a href="#
|
104
|
-
<a href="#
|
105
|
-
<a href="#
|
89
|
+
<a href="#M000006">alpha_generator</a>
|
90
|
+
<a href="#M000007">alpha_numeric_generator</a>
|
91
|
+
<a href="#M000019">city_generator</a>
|
92
|
+
<a href="#M000017">company_generator</a>
|
93
|
+
<a href="#M000013">domain_generator</a>
|
94
|
+
<a href="#M000011">email_generator</a>
|
95
|
+
<a href="#M000014">firstname_generator</a>
|
96
|
+
<a href="#M000015">lastname_generator</a>
|
97
|
+
<a href="#M000010">money_generator</a>
|
98
|
+
<a href="#M000018">name_generator</a>
|
99
|
+
<a href="#M000008">numeric_generator</a>
|
100
|
+
<a href="#M000016">phone_generator</a>
|
101
|
+
<a href="#M000021">state_generator</a>
|
102
|
+
<a href="#M000020">streetname_generator</a>
|
103
|
+
<a href="#M000009">time_generator</a>
|
104
|
+
<a href="#M000012">username_generator</a>
|
105
|
+
<a href="#M000022">zipcode_generator</a>
|
106
106
|
</div>
|
107
107
|
</div>
|
108
108
|
|
@@ -124,129 +124,129 @@
|
|
124
124
|
<div id="methods">
|
125
125
|
<h3 class="section-bar">Public Class methods</h3>
|
126
126
|
|
127
|
-
<div id="method-
|
128
|
-
<a name="
|
127
|
+
<div id="method-M000006" class="method-detail">
|
128
|
+
<a name="M000006"></a>
|
129
129
|
|
130
130
|
<div class="method-heading">
|
131
|
-
<a href="#
|
131
|
+
<a href="#M000006" class="method-signature">
|
132
132
|
<span class="method-name">alpha_generator</span><span class="method-args">()</span>
|
133
133
|
</a>
|
134
134
|
</div>
|
135
135
|
|
136
136
|
<div class="method-description">
|
137
137
|
<p><a class="source-toggle" href="#"
|
138
|
-
onclick="toggleCode('
|
139
|
-
<div class="method-source-code" id="
|
138
|
+
onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
|
139
|
+
<div class="method-source-code" id="M000006-source">
|
140
140
|
<pre>
|
141
|
-
<span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
37:
|
173
|
-
38: <span class="ruby-identifier">ret_val</span>.<span class="ruby-identifier">strip!</span>
|
141
|
+
<span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line 9</span>
|
142
|
+
9: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">alpha_generator</span>
|
143
|
+
10: <span class="ruby-ivar">@alpha_gen</span> = <span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">def_value</span>, <span class="ruby-identifier">rules</span>, <span class="ruby-identifier">index</span><span class="ruby-operator">|</span>
|
144
|
+
11: <span class="ruby-identifier">words</span> = <span class="ruby-node">%w(alias consequatur aut perferendis sit voluptatem accusantium doloremque aperiam eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo aspernatur aut odit aut fugit sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt neque dolorem ipsum quia dolor sit amet consectetur adipisci velit sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem ut enim ad minima veniam quis nostrum exercitationem ullam corporis nemo enim ipsam voluptatem quia voluptas sit suscipit laboriosam nisi ut aliquid ex ea commodi consequatur quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae et iusto odio dignissimos ducimus qui blanditiis praesentium laudantium totam rem voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident sed ut perspiciatis unde omnis iste natus error similique sunt in culpa qui officia deserunt mollitia animi id est laborum et dolorum fuga et harum quidem rerum facilis est et expedita distinctio nam libero tempore cum soluta nobis est eligendi optio cumque nihil impedit quo porro quisquam est qui minus id quod maxime placeat facere possimus omnis voluptas assumenda est omnis dolor repellendus temporibus autem quibusdam et aut consequatur vel illum qui dolorem eum fugiat quo voluptas nulla pariatur at vero eos et accusamus officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae itaque earum rerum hic tenetur a sapiente delectus ut aut reiciendis voluptatibus maiores doloribus asperiores repellat)</span>
|
145
|
+
12:
|
146
|
+
13: <span class="ruby-identifier">length</span> = <span class="ruby-value">128</span>
|
147
|
+
14: <span class="ruby-identifier">min_length</span> = <span class="ruby-value">-1</span>
|
148
|
+
15: <span class="ruby-identifier">max_length</span> = <span class="ruby-value">-1</span>
|
149
|
+
16:
|
150
|
+
17: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rules</span>[<span class="ruby-identifier">:min_length</span>]
|
151
|
+
18: <span class="ruby-identifier">min_length</span> = <span class="ruby-identifier">rules</span>[<span class="ruby-identifier">:min_length</span>].<span class="ruby-identifier">to_i</span>
|
152
|
+
19: <span class="ruby-keyword kw">end</span>
|
153
|
+
20:
|
154
|
+
21: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rules</span>[<span class="ruby-identifier">:max_length</span>]
|
155
|
+
22: <span class="ruby-identifier">max_length</span> = <span class="ruby-identifier">rules</span>[<span class="ruby-identifier">:max_length</span>].<span class="ruby-identifier">to_i</span>
|
156
|
+
23: <span class="ruby-keyword kw">end</span>
|
157
|
+
24:
|
158
|
+
25: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rules</span>[<span class="ruby-identifier">:length</span>]
|
159
|
+
26: <span class="ruby-identifier">length</span> = <span class="ruby-identifier">rules</span>[<span class="ruby-identifier">:length</span>].<span class="ruby-identifier">to_i</span>
|
160
|
+
27: <span class="ruby-identifier">length</span> = <span class="ruby-identifier">max_length</span> <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">max_length</span> <span class="ruby-operator">!=</span> <span class="ruby-value">-1</span>) <span class="ruby-keyword kw">and</span> (<span class="ruby-identifier">max_length</span> <span class="ruby-operator"><=</span> <span class="ruby-identifier">length</span>)
|
161
|
+
28: <span class="ruby-keyword kw">end</span>
|
162
|
+
29:
|
163
|
+
30: <span class="ruby-identifier">ret_val</span> = <span class="ruby-value str">""</span>
|
164
|
+
31: <span class="ruby-identifier">words_size</span> = <span class="ruby-identifier">words</span>.<span class="ruby-identifier">size</span>
|
165
|
+
32: <span class="ruby-keyword kw">until</span> <span class="ruby-identifier">ret_val</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">></span> <span class="ruby-identifier">length</span> <span class="ruby-keyword kw">do</span>
|
166
|
+
33: <span class="ruby-identifier">i</span> = (<span class="ruby-identifier">rand</span> <span class="ruby-operator">*</span> <span class="ruby-value">100</span>).<span class="ruby-identifier">to_i</span>
|
167
|
+
34: <span class="ruby-identifier">i</span> = <span class="ruby-identifier">words_size</span> <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">i</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>) <span class="ruby-operator">></span> <span class="ruby-identifier">words_size</span>
|
168
|
+
35:
|
169
|
+
36: <span class="ruby-identifier">ret_val</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">words</span>[<span class="ruby-identifier">i</span>]
|
170
|
+
37: <span class="ruby-identifier">ret_val</span> <span class="ruby-operator">+=</span> <span class="ruby-value str">" "</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rules</span>[<span class="ruby-identifier">:add_space</span>]
|
171
|
+
38: <span class="ruby-keyword kw">end</span>
|
174
172
|
39:
|
175
|
-
40: <span class="ruby-identifier">ret_val</span
|
173
|
+
40: <span class="ruby-identifier">ret_val</span>.<span class="ruby-identifier">strip!</span>
|
176
174
|
41:
|
177
|
-
42: <span class="ruby-identifier">ret_val</span>
|
178
|
-
43:
|
179
|
-
44:
|
180
|
-
45:
|
175
|
+
42: <span class="ruby-identifier">ret_val</span> = <span class="ruby-identifier">ret_val</span>[<span class="ruby-value">0</span>, <span class="ruby-identifier">length</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ret_val</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">></span> <span class="ruby-identifier">length</span>
|
176
|
+
43:
|
177
|
+
44: <span class="ruby-identifier">ret_val</span>
|
178
|
+
45: <span class="ruby-keyword kw">end</span>
|
179
|
+
46: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@alpha_gen</span>
|
180
|
+
47: <span class="ruby-keyword kw">end</span>
|
181
181
|
</pre>
|
182
182
|
</div>
|
183
183
|
</div>
|
184
184
|
</div>
|
185
185
|
|
186
|
-
<div id="method-
|
187
|
-
<a name="
|
186
|
+
<div id="method-M000007" class="method-detail">
|
187
|
+
<a name="M000007"></a>
|
188
188
|
|
189
189
|
<div class="method-heading">
|
190
|
-
<a href="#
|
190
|
+
<a href="#M000007" class="method-signature">
|
191
191
|
<span class="method-name">alpha_numeric_generator</span><span class="method-args">()</span>
|
192
192
|
</a>
|
193
193
|
</div>
|
194
194
|
|
195
195
|
<div class="method-description">
|
196
196
|
<p><a class="source-toggle" href="#"
|
197
|
-
onclick="toggleCode('
|
198
|
-
<div class="method-source-code" id="
|
197
|
+
onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
|
198
|
+
<div class="method-source-code" id="M000007-source">
|
199
199
|
<pre>
|
200
|
-
<span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
77:
|
232
|
-
78: <span class="ruby-identifier">ret_val</span>.<span class="ruby-identifier">strip!</span>
|
200
|
+
<span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line 49</span>
|
201
|
+
49: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">alpha_numeric_generator</span>
|
202
|
+
50: <span class="ruby-ivar">@alpha_numeric_gen</span> = <span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">def_value</span>, <span class="ruby-identifier">rules</span>, <span class="ruby-identifier">index</span><span class="ruby-operator">|</span>
|
203
|
+
51: <span class="ruby-identifier">words</span> = <span class="ruby-node">%w(alias consequatur aut perferendis sit voluptatem accusantium doloremque aperiam eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo aspernatur aut odit aut fugit sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt neque dolorem ipsum quia dolor sit amet consectetur adipisci velit sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem ut enim ad minima veniam quis nostrum exercitationem ullam corporis nemo enim ipsam voluptatem quia voluptas sit suscipit laboriosam nisi ut aliquid ex ea commodi consequatur quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae et iusto odio dignissimos ducimus qui blanditiis praesentium laudantium totam rem voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident sed ut perspiciatis unde omnis iste natus error similique sunt in culpa qui officia deserunt mollitia animi id est laborum et dolorum fuga et harum quidem rerum facilis est et expedita distinctio nam libero tempore cum soluta nobis est eligendi optio cumque nihil impedit quo porro quisquam est qui minus id quod maxime placeat facere possimus omnis voluptas assumenda est omnis dolor repellendus temporibus autem quibusdam et aut consequatur vel illum qui dolorem eum fugiat quo voluptas nulla pariatur at vero eos et accusamus officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae itaque earum rerum hic tenetur a sapiente delectus ut aut reiciendis voluptatibus maiores doloribus asperiores repellat)</span>
|
204
|
+
52:
|
205
|
+
53: <span class="ruby-identifier">length</span> = <span class="ruby-value">128</span>
|
206
|
+
54: <span class="ruby-identifier">min_length</span> = <span class="ruby-value">-1</span>
|
207
|
+
55: <span class="ruby-identifier">max_length</span> = <span class="ruby-value">-1</span>
|
208
|
+
56:
|
209
|
+
57: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rules</span>[<span class="ruby-identifier">:min_length</span>]
|
210
|
+
58: <span class="ruby-identifier">min_length</span> = <span class="ruby-identifier">rules</span>[<span class="ruby-identifier">:min_length</span>].<span class="ruby-identifier">to_i</span>
|
211
|
+
59: <span class="ruby-keyword kw">end</span>
|
212
|
+
60:
|
213
|
+
61: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rules</span>[<span class="ruby-identifier">:max_length</span>]
|
214
|
+
62: <span class="ruby-identifier">max_length</span> = <span class="ruby-identifier">rules</span>[<span class="ruby-identifier">:max_length</span>].<span class="ruby-identifier">to_i</span>
|
215
|
+
63: <span class="ruby-keyword kw">end</span>
|
216
|
+
64:
|
217
|
+
65: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rules</span>[<span class="ruby-identifier">:length</span>]
|
218
|
+
66: <span class="ruby-identifier">length</span> = <span class="ruby-identifier">rules</span>[<span class="ruby-identifier">:length</span>].<span class="ruby-identifier">to_i</span>
|
219
|
+
67: <span class="ruby-identifier">length</span> = <span class="ruby-identifier">max_length</span> <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">max_length</span> <span class="ruby-operator">!=</span> <span class="ruby-value">-1</span>) <span class="ruby-keyword kw">and</span> (<span class="ruby-identifier">max_length</span> <span class="ruby-operator"><=</span> <span class="ruby-identifier">length</span>)
|
220
|
+
68: <span class="ruby-keyword kw">end</span>
|
221
|
+
69:
|
222
|
+
70: <span class="ruby-identifier">ret_val</span> = <span class="ruby-value str">""</span>
|
223
|
+
71: <span class="ruby-identifier">words_size</span> = <span class="ruby-identifier">words</span>.<span class="ruby-identifier">size</span>
|
224
|
+
72: <span class="ruby-keyword kw">until</span> <span class="ruby-identifier">ret_val</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">></span> <span class="ruby-identifier">length</span> <span class="ruby-keyword kw">do</span>
|
225
|
+
73: <span class="ruby-identifier">i</span> = (<span class="ruby-identifier">rand</span> <span class="ruby-operator">*</span> <span class="ruby-value">100</span>).<span class="ruby-identifier">to_i</span>
|
226
|
+
74: <span class="ruby-identifier">i</span> = <span class="ruby-identifier">words_size</span> <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">i</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>) <span class="ruby-operator">></span> <span class="ruby-identifier">words_size</span>
|
227
|
+
75:
|
228
|
+
76: <span class="ruby-identifier">ret_val</span> <span class="ruby-operator">+=</span> (<span class="ruby-identifier">words</span>[<span class="ruby-identifier">i</span>] <span class="ruby-operator">+</span> (<span class="ruby-identifier">rand</span> <span class="ruby-operator">*</span> <span class="ruby-value">1000</span>).<span class="ruby-identifier">to_i</span>.<span class="ruby-identifier">to_s</span>)
|
229
|
+
77: <span class="ruby-identifier">ret_val</span> <span class="ruby-operator">+=</span> <span class="ruby-value str">" "</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rules</span>[<span class="ruby-identifier">:add_space</span>]
|
230
|
+
78: <span class="ruby-keyword kw">end</span>
|
233
231
|
79:
|
234
|
-
80: <span class="ruby-identifier">ret_val</span
|
232
|
+
80: <span class="ruby-identifier">ret_val</span>.<span class="ruby-identifier">strip!</span>
|
235
233
|
81:
|
236
|
-
82: <span class="ruby-identifier">ret_val</span>
|
237
|
-
83:
|
238
|
-
84:
|
239
|
-
85:
|
234
|
+
82: <span class="ruby-identifier">ret_val</span> = <span class="ruby-identifier">ret_val</span>[<span class="ruby-value">0</span>, <span class="ruby-identifier">length</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ret_val</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">></span> <span class="ruby-identifier">length</span>
|
235
|
+
83:
|
236
|
+
84: <span class="ruby-identifier">ret_val</span>
|
237
|
+
85: <span class="ruby-keyword kw">end</span>
|
238
|
+
86: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@alpha_numeric_gen</span>
|
239
|
+
87: <span class="ruby-keyword kw">end</span>
|
240
240
|
</pre>
|
241
241
|
</div>
|
242
242
|
</div>
|
243
243
|
</div>
|
244
244
|
|
245
|
-
<div id="method-
|
246
|
-
<a name="
|
245
|
+
<div id="method-M000019" class="method-detail">
|
246
|
+
<a name="M000019"></a>
|
247
247
|
|
248
248
|
<div class="method-heading">
|
249
|
-
<a href="#
|
249
|
+
<a href="#M000019" class="method-signature">
|
250
250
|
<span class="method-name">city_generator</span><span class="method-args">()</span>
|
251
251
|
</a>
|
252
252
|
</div>
|
@@ -256,286 +256,305 @@
|
|
256
256
|
Address Generators
|
257
257
|
</p>
|
258
258
|
<p><a class="source-toggle" href="#"
|
259
|
-
onclick="toggleCode('
|
260
|
-
<div class="method-source-code" id="
|
259
|
+
onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
|
260
|
+
<div class="method-source-code" id="M000019-source">
|
261
261
|
<pre>
|
262
|
-
<span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
262
|
+
<span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line 192</span>
|
263
|
+
192: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">city_generator</span>
|
264
|
+
193: <span class="ruby-ivar">@city_gen</span> = <span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">def_value</span>, <span class="ruby-identifier">rules</span>, <span class="ruby-identifier">index</span><span class="ruby-operator">|</span>
|
265
|
+
194: <span class="ruby-constant">Faker</span><span class="ruby-operator">::</span><span class="ruby-constant">Address</span>.<span class="ruby-identifier">city</span>
|
266
|
+
195: <span class="ruby-keyword kw">end</span>
|
267
|
+
196: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@city_gen</span>
|
268
|
+
197: <span class="ruby-keyword kw">end</span>
|
269
269
|
</pre>
|
270
270
|
</div>
|
271
271
|
</div>
|
272
272
|
</div>
|
273
273
|
|
274
|
-
<div id="method-
|
275
|
-
<a name="
|
274
|
+
<div id="method-M000017" class="method-detail">
|
275
|
+
<a name="M000017"></a>
|
276
276
|
|
277
277
|
<div class="method-heading">
|
278
|
-
<a href="#
|
278
|
+
<a href="#M000017" class="method-signature">
|
279
279
|
<span class="method-name">company_generator</span><span class="method-args">()</span>
|
280
280
|
</a>
|
281
281
|
</div>
|
282
282
|
|
283
283
|
<div class="method-description">
|
284
284
|
<p><a class="source-toggle" href="#"
|
285
|
-
onclick="toggleCode('
|
286
|
-
<div class="method-source-code" id="
|
285
|
+
onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
|
286
|
+
<div class="method-source-code" id="M000017-source">
|
287
287
|
<pre>
|
288
|
-
<span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
288
|
+
<span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line 170</span>
|
289
|
+
170: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">company_generator</span>
|
290
|
+
171: <span class="ruby-ivar">@company_gen</span> = <span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">def_value</span>, <span class="ruby-identifier">rules</span>, <span class="ruby-identifier">index</span><span class="ruby-operator">|</span>
|
291
|
+
172: <span class="ruby-identifier">str</span> = <span class="ruby-constant">Faker</span><span class="ruby-operator">::</span><span class="ruby-constant">Company</span>.<span class="ruby-identifier">name</span>
|
292
|
+
173:
|
293
|
+
174: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rules</span>[<span class="ruby-identifier">:include_bs</span>]
|
294
|
+
175: <span class="ruby-identifier">str</span> <span class="ruby-operator">+=</span> <span class="ruby-node">"\n#{Faker::Company.bs}"</span>
|
295
|
+
176: <span class="ruby-keyword kw">end</span>
|
296
|
+
177:
|
297
|
+
178: <span class="ruby-identifier">str</span>
|
298
|
+
179: <span class="ruby-keyword kw">end</span>
|
299
|
+
180: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@company_gen</span>
|
300
|
+
181: <span class="ruby-keyword kw">end</span>
|
301
301
|
</pre>
|
302
302
|
</div>
|
303
303
|
</div>
|
304
304
|
</div>
|
305
305
|
|
306
|
-
<div id="method-
|
307
|
-
<a name="
|
306
|
+
<div id="method-M000013" class="method-detail">
|
307
|
+
<a name="M000013"></a>
|
308
308
|
|
309
309
|
<div class="method-heading">
|
310
|
-
<a href="#
|
311
|
-
<span class="method-name">
|
310
|
+
<a href="#M000013" class="method-signature">
|
311
|
+
<span class="method-name">domain_generator</span><span class="method-args">()</span>
|
312
312
|
</a>
|
313
313
|
</div>
|
314
314
|
|
315
315
|
<div class="method-description">
|
316
316
|
<p><a class="source-toggle" href="#"
|
317
|
-
onclick="toggleCode('
|
318
|
-
<div class="method-source-code" id="
|
317
|
+
onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
|
318
|
+
<div class="method-source-code" id="M000013-source">
|
319
319
|
<pre>
|
320
|
-
<span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
320
|
+
<span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line 142</span>
|
321
|
+
142: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">domain_generator</span>
|
322
|
+
143: <span class="ruby-ivar">@domain_gen</span> = <span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">def_value</span>, <span class="ruby-identifier">rules</span>, <span class="ruby-identifier">index</span><span class="ruby-operator">|</span>
|
323
|
+
144: <span class="ruby-constant">Faker</span><span class="ruby-operator">::</span><span class="ruby-constant">Internet</span>.<span class="ruby-identifier">domain_name</span>
|
324
|
+
145: <span class="ruby-keyword kw">end</span>
|
325
|
+
146: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@domain_gen</span>
|
326
|
+
147: <span class="ruby-keyword kw">end</span>
|
327
327
|
</pre>
|
328
328
|
</div>
|
329
329
|
</div>
|
330
330
|
</div>
|
331
331
|
|
332
|
-
<div id="method-
|
333
|
-
<a name="
|
332
|
+
<div id="method-M000011" class="method-detail">
|
333
|
+
<a name="M000011"></a>
|
334
334
|
|
335
335
|
<div class="method-heading">
|
336
|
-
<a href="#
|
337
|
-
<span class="method-name">
|
336
|
+
<a href="#M000011" class="method-signature">
|
337
|
+
<span class="method-name">email_generator</span><span class="method-args">()</span>
|
338
338
|
</a>
|
339
339
|
</div>
|
340
340
|
|
341
341
|
<div class="method-description">
|
342
342
|
<p><a class="source-toggle" href="#"
|
343
|
-
onclick="toggleCode('
|
344
|
-
<div class="method-source-code" id="
|
343
|
+
onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
|
344
|
+
<div class="method-source-code" id="M000011-source">
|
345
345
|
<pre>
|
346
|
-
<span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
346
|
+
<span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line 128</span>
|
347
|
+
128: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">email_generator</span>
|
348
|
+
129: <span class="ruby-ivar">@email_gen</span> = <span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">def_value</span>, <span class="ruby-identifier">rules</span>, <span class="ruby-identifier">index</span><span class="ruby-operator">|</span>
|
349
|
+
130: <span class="ruby-constant">Faker</span><span class="ruby-operator">::</span><span class="ruby-constant">Internet</span>.<span class="ruby-identifier">free_email</span>
|
350
|
+
131: <span class="ruby-keyword kw">end</span>
|
351
|
+
132: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@email_gen</span>
|
352
|
+
133: <span class="ruby-keyword kw">end</span>
|
353
353
|
</pre>
|
354
354
|
</div>
|
355
355
|
</div>
|
356
356
|
</div>
|
357
357
|
|
358
|
-
<div id="method-
|
359
|
-
<a name="
|
358
|
+
<div id="method-M000014" class="method-detail">
|
359
|
+
<a name="M000014"></a>
|
360
360
|
|
361
361
|
<div class="method-heading">
|
362
|
-
<a href="#
|
363
|
-
<span class="method-name">
|
362
|
+
<a href="#M000014" class="method-signature">
|
363
|
+
<span class="method-name">firstname_generator</span><span class="method-args">()</span>
|
364
364
|
</a>
|
365
365
|
</div>
|
366
366
|
|
367
367
|
<div class="method-description">
|
368
368
|
<p><a class="source-toggle" href="#"
|
369
|
-
onclick="toggleCode('
|
370
|
-
<div class="method-source-code" id="
|
369
|
+
onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
|
370
|
+
<div class="method-source-code" id="M000014-source">
|
371
371
|
<pre>
|
372
|
-
<span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
372
|
+
<span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line 149</span>
|
373
|
+
149: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">firstname_generator</span>
|
374
|
+
150: <span class="ruby-ivar">@fn_gen</span> = <span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">def_value</span>, <span class="ruby-identifier">rules</span>, <span class="ruby-identifier">index</span><span class="ruby-operator">|</span>
|
375
|
+
151: <span class="ruby-constant">Faker</span><span class="ruby-operator">::</span><span class="ruby-constant">Name</span>.<span class="ruby-identifier">first_name</span>
|
376
|
+
152: <span class="ruby-keyword kw">end</span>
|
377
|
+
153: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@fn_gen</span>
|
378
|
+
154: <span class="ruby-keyword kw">end</span>
|
379
379
|
</pre>
|
380
380
|
</div>
|
381
381
|
</div>
|
382
382
|
</div>
|
383
383
|
|
384
|
-
<div id="method-
|
385
|
-
<a name="
|
384
|
+
<div id="method-M000015" class="method-detail">
|
385
|
+
<a name="M000015"></a>
|
386
386
|
|
387
387
|
<div class="method-heading">
|
388
|
-
<a href="#
|
389
|
-
<span class="method-name">
|
388
|
+
<a href="#M000015" class="method-signature">
|
389
|
+
<span class="method-name">lastname_generator</span><span class="method-args">()</span>
|
390
390
|
</a>
|
391
391
|
</div>
|
392
392
|
|
393
393
|
<div class="method-description">
|
394
394
|
<p><a class="source-toggle" href="#"
|
395
|
-
onclick="toggleCode('
|
396
|
-
<div class="method-source-code" id="
|
395
|
+
onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
|
396
|
+
<div class="method-source-code" id="M000015-source">
|
397
397
|
<pre>
|
398
|
-
<span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
398
|
+
<span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line 156</span>
|
399
|
+
156: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">lastname_generator</span>
|
400
|
+
157: <span class="ruby-ivar">@ln_gen</span> = <span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">def_value</span>, <span class="ruby-identifier">rules</span>, <span class="ruby-identifier">index</span><span class="ruby-operator">|</span>
|
401
|
+
158: <span class="ruby-constant">Faker</span><span class="ruby-operator">::</span><span class="ruby-constant">Name</span>.<span class="ruby-identifier">last_name</span>
|
402
|
+
159: <span class="ruby-keyword kw">end</span>
|
403
|
+
160: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@ln_gen</span>
|
404
|
+
161: <span class="ruby-keyword kw">end</span>
|
405
405
|
</pre>
|
406
406
|
</div>
|
407
407
|
</div>
|
408
408
|
</div>
|
409
409
|
|
410
|
-
<div id="method-
|
411
|
-
<a name="
|
410
|
+
<div id="method-M000010" class="method-detail">
|
411
|
+
<a name="M000010"></a>
|
412
412
|
|
413
413
|
<div class="method-heading">
|
414
|
-
<a href="#
|
415
|
-
<span class="method-name">
|
414
|
+
<a href="#M000010" class="method-signature">
|
415
|
+
<span class="method-name">money_generator</span><span class="method-args">()</span>
|
416
416
|
</a>
|
417
417
|
</div>
|
418
418
|
|
419
419
|
<div class="method-description">
|
420
|
+
<p>
|
421
|
+
def date_time_generator
|
422
|
+
</p>
|
423
|
+
<pre>
|
424
|
+
@date_time_gen = Proc.new do |def_value, rules, index|
|
425
|
+
Time.now.to_s
|
426
|
+
end
|
427
|
+
return @date_time_gen
|
428
|
+
</pre>
|
429
|
+
<p>
|
430
|
+
end
|
431
|
+
</p>
|
420
432
|
<p><a class="source-toggle" href="#"
|
421
|
-
onclick="toggleCode('
|
422
|
-
<div class="method-source-code" id="
|
433
|
+
onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
|
434
|
+
<div class="method-source-code" id="M000010-source">
|
423
435
|
<pre>
|
424
|
-
<span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
436
|
+
<span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line 118</span>
|
437
|
+
118: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">money_generator</span>
|
438
|
+
119: <span class="ruby-ivar">@money_gen</span> = <span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">def_value</span>, <span class="ruby-identifier">rules</span>, <span class="ruby-identifier">index</span><span class="ruby-operator">|</span>
|
439
|
+
120: <span class="ruby-identifier">min</span> = <span class="ruby-identifier">rules</span>[<span class="ruby-identifier">:min</span>] <span class="ruby-operator">||</span> <span class="ruby-value">0</span><span class="ruby-value">.00</span>
|
440
|
+
121: <span class="ruby-identifier">max</span> = <span class="ruby-identifier">rules</span>[<span class="ruby-identifier">:max</span>] <span class="ruby-operator">||</span> <span class="ruby-value">500.75</span>
|
441
|
+
122: <span class="ruby-identifier">diff</span> = <span class="ruby-identifier">rand</span> <span class="ruby-operator">*</span> (<span class="ruby-identifier">max</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">min</span>)
|
442
|
+
123: <span class="ruby-constant">BigDecimal</span>((<span class="ruby-identifier">min</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">diff</span>).<span class="ruby-identifier">to_s</span>)
|
443
|
+
124: <span class="ruby-keyword kw">end</span>
|
444
|
+
125: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@money_gen</span>
|
445
|
+
126: <span class="ruby-keyword kw">end</span>
|
431
446
|
</pre>
|
432
447
|
</div>
|
433
448
|
</div>
|
434
449
|
</div>
|
435
450
|
|
436
|
-
<div id="method-
|
437
|
-
<a name="
|
451
|
+
<div id="method-M000018" class="method-detail">
|
452
|
+
<a name="M000018"></a>
|
438
453
|
|
439
454
|
<div class="method-heading">
|
440
|
-
<a href="#
|
441
|
-
<span class="method-name">
|
455
|
+
<a href="#M000018" class="method-signature">
|
456
|
+
<span class="method-name">name_generator</span><span class="method-args">()</span>
|
442
457
|
</a>
|
443
458
|
</div>
|
444
459
|
|
445
460
|
<div class="method-description">
|
446
461
|
<p><a class="source-toggle" href="#"
|
447
|
-
onclick="toggleCode('
|
448
|
-
<div class="method-source-code" id="
|
462
|
+
onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
|
463
|
+
<div class="method-source-code" id="M000018-source">
|
449
464
|
<pre>
|
450
|
-
<span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
465
|
+
<span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line 183</span>
|
466
|
+
183: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">name_generator</span>
|
467
|
+
184: <span class="ruby-ivar">@name_gen</span> = <span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">def_value</span>, <span class="ruby-identifier">rules</span>, <span class="ruby-identifier">index</span><span class="ruby-operator">|</span>
|
468
|
+
185: <span class="ruby-constant">Faker</span><span class="ruby-operator">::</span><span class="ruby-constant">Name</span>.<span class="ruby-identifier">name</span>
|
469
|
+
186: <span class="ruby-keyword kw">end</span>
|
470
|
+
187: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@name_gen</span>
|
471
|
+
188: <span class="ruby-keyword kw">end</span>
|
457
472
|
</pre>
|
458
473
|
</div>
|
459
474
|
</div>
|
460
475
|
</div>
|
461
476
|
|
462
|
-
<div id="method-
|
463
|
-
<a name="
|
477
|
+
<div id="method-M000008" class="method-detail">
|
478
|
+
<a name="M000008"></a>
|
464
479
|
|
465
480
|
<div class="method-heading">
|
466
|
-
<a href="#
|
467
|
-
<span class="method-name">
|
481
|
+
<a href="#M000008" class="method-signature">
|
482
|
+
<span class="method-name">numeric_generator</span><span class="method-args">()</span>
|
468
483
|
</a>
|
469
484
|
</div>
|
470
485
|
|
471
486
|
<div class="method-description">
|
472
487
|
<p><a class="source-toggle" href="#"
|
473
|
-
onclick="toggleCode('
|
474
|
-
<div class="method-source-code" id="
|
488
|
+
onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
|
489
|
+
<div class="method-source-code" id="M000008-source">
|
475
490
|
<pre>
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
491
|
+
<span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line 89</span>
|
492
|
+
89: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">numeric_generator</span>
|
493
|
+
90: <span class="ruby-ivar">@numeric_gen</span> = <span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">def_value</span>, <span class="ruby-identifier">rules</span>, <span class="ruby-identifier">index</span><span class="ruby-operator">|</span>
|
494
|
+
91: <span class="ruby-identifier">n_start</span> = <span class="ruby-identifier">rules</span>[<span class="ruby-identifier">:start_num</span>] <span class="ruby-operator">||</span> <span class="ruby-value">0</span>
|
495
|
+
92: <span class="ruby-identifier">n_end</span> = <span class="ruby-identifier">rules</span>[<span class="ruby-identifier">:end_num</span>] <span class="ruby-operator">||</span> <span class="ruby-value">1000</span>
|
496
|
+
93:
|
497
|
+
94: <span class="ruby-identifier">val</span> = (<span class="ruby-identifier">n_start</span><span class="ruby-operator">..</span><span class="ruby-identifier">n_end</span>).<span class="ruby-identifier">to_a</span>.<span class="ruby-identifier">randomize</span>[<span class="ruby-value">0</span>]
|
498
|
+
95: <span class="ruby-identifier">val</span>
|
499
|
+
96: <span class="ruby-keyword kw">end</span>
|
500
|
+
97: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@numeric_gen</span>
|
501
|
+
98: <span class="ruby-keyword kw">end</span>
|
483
502
|
</pre>
|
484
503
|
</div>
|
485
504
|
</div>
|
486
505
|
</div>
|
487
506
|
|
488
|
-
<div id="method-
|
489
|
-
<a name="
|
507
|
+
<div id="method-M000016" class="method-detail">
|
508
|
+
<a name="M000016"></a>
|
490
509
|
|
491
510
|
<div class="method-heading">
|
492
|
-
<a href="#
|
493
|
-
<span class="method-name">
|
511
|
+
<a href="#M000016" class="method-signature">
|
512
|
+
<span class="method-name">phone_generator</span><span class="method-args">()</span>
|
494
513
|
</a>
|
495
514
|
</div>
|
496
515
|
|
497
516
|
<div class="method-description">
|
498
517
|
<p><a class="source-toggle" href="#"
|
499
|
-
onclick="toggleCode('
|
500
|
-
<div class="method-source-code" id="
|
518
|
+
onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
|
519
|
+
<div class="method-source-code" id="M000016-source">
|
501
520
|
<pre>
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
93: <span class="ruby-identifier">val</span>
|
510
|
-
94: <span class="ruby-keyword kw">end</span>
|
511
|
-
95: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@numeric_gen</span>
|
512
|
-
96: <span class="ruby-keyword kw">end</span>
|
521
|
+
<span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line 163</span>
|
522
|
+
163: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">phone_generator</span>
|
523
|
+
164: <span class="ruby-ivar">@phone_gen</span> = <span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">def_value</span>, <span class="ruby-identifier">rules</span>, <span class="ruby-identifier">index</span><span class="ruby-operator">|</span>
|
524
|
+
165: <span class="ruby-constant">Faker</span><span class="ruby-operator">::</span><span class="ruby-constant">PhoneNumber</span>.<span class="ruby-identifier">phone_number</span>
|
525
|
+
166: <span class="ruby-keyword kw">end</span>
|
526
|
+
167: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@phone_gen</span>
|
527
|
+
168: <span class="ruby-keyword kw">end</span>
|
513
528
|
</pre>
|
514
529
|
</div>
|
515
530
|
</div>
|
516
531
|
</div>
|
517
532
|
|
518
|
-
<div id="method-
|
519
|
-
<a name="
|
533
|
+
<div id="method-M000021" class="method-detail">
|
534
|
+
<a name="M000021"></a>
|
520
535
|
|
521
536
|
<div class="method-heading">
|
522
|
-
<a href="#
|
523
|
-
<span class="method-name">
|
537
|
+
<a href="#M000021" class="method-signature">
|
538
|
+
<span class="method-name">state_generator</span><span class="method-args">()</span>
|
524
539
|
</a>
|
525
540
|
</div>
|
526
541
|
|
527
542
|
<div class="method-description">
|
528
543
|
<p><a class="source-toggle" href="#"
|
529
|
-
onclick="toggleCode('
|
530
|
-
<div class="method-source-code" id="
|
544
|
+
onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
|
545
|
+
<div class="method-source-code" id="M000021-source">
|
531
546
|
<pre>
|
532
|
-
<span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
547
|
+
<span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line 206</span>
|
548
|
+
206: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">state_generator</span>
|
549
|
+
207: <span class="ruby-ivar">@state_gen</span> = <span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">def_value</span>, <span class="ruby-identifier">rules</span>, <span class="ruby-identifier">index</span><span class="ruby-operator">|</span>
|
550
|
+
208: <span class="ruby-identifier">supported_countries</span> = [<span class="ruby-identifier">:us</span>, <span class="ruby-identifier">:uk</span>]
|
551
|
+
209: <span class="ruby-identifier">us_or_uk</span> = <span class="ruby-identifier">:us</span>
|
552
|
+
210: <span class="ruby-identifier">us_or_uk</span> = <span class="ruby-identifier">:uk</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rules</span>[<span class="ruby-identifier">:country</span>] <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">rules</span>[<span class="ruby-identifier">:country</span>].<span class="ruby-identifier">to_sym</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:uk</span>
|
553
|
+
211: <span class="ruby-identifier">abbr</span> = (<span class="ruby-identifier">us_or_uk</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:us</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">rules</span>[<span class="ruby-identifier">:abbr</span>]) <span class="ruby-operator">?</span> <span class="ruby-value str">"_abbr"</span> <span class="ruby-operator">:</span> <span class="ruby-value str">""</span>
|
554
|
+
212: <span class="ruby-constant">Faker</span><span class="ruby-operator">::</span><span class="ruby-constant">Address</span>.<span class="ruby-identifier">send</span>(<span class="ruby-node">"#{us_or_uk.to_s}_state#{abbr}"</span>)
|
555
|
+
213: <span class="ruby-keyword kw">end</span>
|
556
|
+
214: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@state_gen</span>
|
557
|
+
215: <span class="ruby-keyword kw">end</span>
|
539
558
|
</pre>
|
540
559
|
</div>
|
541
560
|
</div>
|
@@ -546,7 +565,7 @@ Address Generators
|
|
546
565
|
|
547
566
|
<div class="method-heading">
|
548
567
|
<a href="#M000020" class="method-signature">
|
549
|
-
<span class="method-name">
|
568
|
+
<span class="method-name">streetname_generator</span><span class="method-args">()</span>
|
550
569
|
</a>
|
551
570
|
</div>
|
552
571
|
|
@@ -555,97 +574,97 @@ Address Generators
|
|
555
574
|
onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
|
556
575
|
<div class="method-source-code" id="M000020-source">
|
557
576
|
<pre>
|
558
|
-
<span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
197: <span class="ruby-constant">Faker</span><span class="ruby-operator">::</span><span class="ruby-constant">Address</span>.<span class="ruby-identifier">send</span>(<span class="ruby-node">"#{us_or_uk.to_s}_state#{abbr}"</span>)
|
566
|
-
198: <span class="ruby-keyword kw">end</span>
|
567
|
-
199: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@state_gen</span>
|
568
|
-
200: <span class="ruby-keyword kw">end</span>
|
577
|
+
<span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line 199</span>
|
578
|
+
199: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">streetname_generator</span>
|
579
|
+
200: <span class="ruby-ivar">@sn_gen</span> = <span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">def_value</span>, <span class="ruby-identifier">rules</span>, <span class="ruby-identifier">index</span><span class="ruby-operator">|</span>
|
580
|
+
201: <span class="ruby-constant">Faker</span><span class="ruby-operator">::</span><span class="ruby-constant">Address</span>.<span class="ruby-identifier">street_name</span>
|
581
|
+
202: <span class="ruby-keyword kw">end</span>
|
582
|
+
203: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@sn_gen</span>
|
583
|
+
204: <span class="ruby-keyword kw">end</span>
|
569
584
|
</pre>
|
570
585
|
</div>
|
571
586
|
</div>
|
572
587
|
</div>
|
573
588
|
|
574
|
-
<div id="method-
|
575
|
-
<a name="
|
589
|
+
<div id="method-M000009" class="method-detail">
|
590
|
+
<a name="M000009"></a>
|
576
591
|
|
577
592
|
<div class="method-heading">
|
578
|
-
<a href="#
|
579
|
-
<span class="method-name">
|
593
|
+
<a href="#M000009" class="method-signature">
|
594
|
+
<span class="method-name">time_generator</span><span class="method-args">()</span>
|
580
595
|
</a>
|
581
596
|
</div>
|
582
597
|
|
583
598
|
<div class="method-description">
|
584
599
|
<p><a class="source-toggle" href="#"
|
585
|
-
onclick="toggleCode('
|
586
|
-
<div class="method-source-code" id="
|
600
|
+
onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
|
601
|
+
<div class="method-source-code" id="M000009-source">
|
587
602
|
<pre>
|
588
|
-
<span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
603
|
+
<span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line 100</span>
|
604
|
+
100: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">time_generator</span>
|
605
|
+
101: <span class="ruby-ivar">@date_gen</span> = <span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">def_value</span>, <span class="ruby-identifier">rules</span>, <span class="ruby-identifier">index</span><span class="ruby-operator">|</span>
|
606
|
+
102: <span class="ruby-identifier">start_time</span> = <span class="ruby-identifier">rules</span>[<span class="ruby-identifier">:start_time</span>] <span class="ruby-operator">||</span> <span class="ruby-value">1</span>.<span class="ruby-identifier">day</span>.<span class="ruby-identifier">ago</span>
|
607
|
+
103: <span class="ruby-identifier">end_time</span> = <span class="ruby-identifier">rules</span>[<span class="ruby-identifier">:end_time</span>] <span class="ruby-operator">||</span> <span class="ruby-value">1</span>.<span class="ruby-identifier">day</span>.<span class="ruby-identifier">from_now</span>
|
608
|
+
104:
|
609
|
+
105: <span class="ruby-identifier">diff</span> = (<span class="ruby-identifier">end_time</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">start_time</span>).<span class="ruby-identifier">to_i</span>
|
610
|
+
106: <span class="ruby-identifier">start_time</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">rand</span>(<span class="ruby-identifier">diff</span>).<span class="ruby-identifier">to_i</span>
|
611
|
+
107: <span class="ruby-keyword kw">end</span>
|
612
|
+
108: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@date_gen</span>
|
613
|
+
109: <span class="ruby-keyword kw">end</span>
|
595
614
|
</pre>
|
596
615
|
</div>
|
597
616
|
</div>
|
598
617
|
</div>
|
599
618
|
|
600
|
-
<div id="method-
|
601
|
-
<a name="
|
619
|
+
<div id="method-M000012" class="method-detail">
|
620
|
+
<a name="M000012"></a>
|
602
621
|
|
603
622
|
<div class="method-heading">
|
604
|
-
<a href="#
|
623
|
+
<a href="#M000012" class="method-signature">
|
605
624
|
<span class="method-name">username_generator</span><span class="method-args">()</span>
|
606
625
|
</a>
|
607
626
|
</div>
|
608
627
|
|
609
628
|
<div class="method-description">
|
610
629
|
<p><a class="source-toggle" href="#"
|
611
|
-
onclick="toggleCode('
|
612
|
-
<div class="method-source-code" id="
|
630
|
+
onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
|
631
|
+
<div class="method-source-code" id="M000012-source">
|
613
632
|
<pre>
|
614
|
-
<span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
633
|
+
<span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line 135</span>
|
634
|
+
135: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">username_generator</span>
|
635
|
+
136: <span class="ruby-ivar">@username_gen</span> = <span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">def_value</span>, <span class="ruby-identifier">rules</span>, <span class="ruby-identifier">index</span><span class="ruby-operator">|</span>
|
636
|
+
137: <span class="ruby-constant">Faker</span><span class="ruby-operator">::</span><span class="ruby-constant">Internet</span>.<span class="ruby-identifier">user_name</span>
|
637
|
+
138: <span class="ruby-keyword kw">end</span>
|
638
|
+
139: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@username_gen</span>
|
639
|
+
140: <span class="ruby-keyword kw">end</span>
|
621
640
|
</pre>
|
622
641
|
</div>
|
623
642
|
</div>
|
624
643
|
</div>
|
625
644
|
|
626
|
-
<div id="method-
|
627
|
-
<a name="
|
645
|
+
<div id="method-M000022" class="method-detail">
|
646
|
+
<a name="M000022"></a>
|
628
647
|
|
629
648
|
<div class="method-heading">
|
630
|
-
<a href="#
|
649
|
+
<a href="#M000022" class="method-signature">
|
631
650
|
<span class="method-name">zipcode_generator</span><span class="method-args">()</span>
|
632
651
|
</a>
|
633
652
|
</div>
|
634
653
|
|
635
654
|
<div class="method-description">
|
636
655
|
<p><a class="source-toggle" href="#"
|
637
|
-
onclick="toggleCode('
|
638
|
-
<div class="method-source-code" id="
|
656
|
+
onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
|
657
|
+
<div class="method-source-code" id="M000022-source">
|
639
658
|
<pre>
|
640
|
-
<span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
659
|
+
<span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line 217</span>
|
660
|
+
217: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">zipcode_generator</span>
|
661
|
+
218: <span class="ruby-ivar">@zip_gen</span> = <span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">def_value</span>, <span class="ruby-identifier">rules</span>, <span class="ruby-identifier">index</span><span class="ruby-operator">|</span>
|
662
|
+
219: <span class="ruby-identifier">ret_val</span> = <span class="ruby-constant">Faker</span><span class="ruby-operator">::</span><span class="ruby-constant">Address</span>.<span class="ruby-identifier">zip_code</span>
|
663
|
+
220: <span class="ruby-identifier">ret_val</span> = <span class="ruby-constant">Faker</span><span class="ruby-operator">::</span><span class="ruby-constant">Address</span>.<span class="ruby-identifier">uk_postcode</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rules</span>[<span class="ruby-identifier">:country</span>] <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">rules</span>[<span class="ruby-identifier">:country</span>].<span class="ruby-identifier">to_sym</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:uk</span>
|
664
|
+
221: <span class="ruby-identifier">ret_val</span>
|
665
|
+
222: <span class="ruby-keyword kw">end</span>
|
666
|
+
223: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@zip_gen</span>
|
667
|
+
224: <span class="ruby-keyword kw">end</span>
|
649
668
|
</pre>
|
650
669
|
</div>
|
651
670
|
</div>
|