mack-data_factory 0.6.1.1 → 0.6.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. data/doc/classes/Kernel.html +207 -0
  2. data/doc/classes/Mack.html +143 -0
  3. data/doc/classes/Mack/Data/Bridge.html +269 -0
  4. data/doc/classes/Mack/Data/Factory.html +171 -0
  5. data/doc/classes/Mack/Data/Factory/ClassMethods.html +262 -0
  6. data/doc/classes/Mack/Data/Factory/FieldContentGenerator.html +666 -0
  7. data/doc/classes/Mack/Data/Field.html +267 -0
  8. data/doc/classes/Mack/Data/FieldMgr.html +217 -0
  9. data/doc/classes/Mack/Data/OrmBridge/ActiveRecord.html +267 -0
  10. data/doc/classes/Mack/Data/OrmBridge/DataMapper.html +267 -0
  11. data/doc/classes/Mack/Data/OrmBridge/Default.html +266 -0
  12. data/doc/created.rid +1 -0
  13. data/doc/files/README.html +107 -0
  14. data/doc/files/lib/mack-data_factory/content_generator_rb.html +101 -0
  15. data/doc/files/lib/mack-data_factory/core_extensions/kernel_rb.html +101 -0
  16. data/doc/files/lib/mack-data_factory/data_factory_rb.html +101 -0
  17. data/doc/files/lib/mack-data_factory/field_manager_rb.html +101 -0
  18. data/doc/files/lib/mack-data_factory/field_rb.html +101 -0
  19. data/doc/files/lib/mack-data_factory/orm_api_bridge/bridge_rb.html +101 -0
  20. data/doc/files/lib/mack-data_factory/orm_api_bridge/orm/active_record_rb.html +101 -0
  21. data/doc/files/lib/mack-data_factory/orm_api_bridge/orm/data_mapper_rb.html +101 -0
  22. data/doc/files/lib/mack-data_factory/orm_api_bridge/orm/default_rb.html +101 -0
  23. data/doc/files/lib/mack-data_factory_rb.html +108 -0
  24. data/doc/fr_class_index.html +42 -0
  25. data/doc/fr_file_index.html +37 -0
  26. data/doc/fr_method_index.html +78 -0
  27. data/doc/index.html +24 -0
  28. data/doc/rdoc-style.css +208 -0
  29. metadata +30 -2
@@ -0,0 +1,171 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Module: Mack::Data::Factory</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Module</strong></td>
53
+ <td class="class-name-in-header">Mack::Data::Factory</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../../files/lib/mack-data_factory/content_generator_rb.html">
59
+ lib/mack-data_factory/content_generator.rb
60
+ </a>
61
+ <br />
62
+ <a href="../../../files/lib/mack-data_factory/data_factory_rb.html">
63
+ lib/mack-data_factory/data_factory.rb
64
+ </a>
65
+ <br />
66
+ </td>
67
+ </tr>
68
+
69
+ </table>
70
+ </div>
71
+ <!-- banner header -->
72
+
73
+ <div id="bodyContent">
74
+
75
+
76
+
77
+ <div id="contextContent">
78
+
79
+ <div id="description">
80
+ <p>
81
+ Add factory capability to a class.
82
+ </p>
83
+ <p>
84
+ A factory is able to define which field it want to generate content for,
85
+ define a scope for different situation, and set a custom content generator
86
+ for field that doesn&#8216;t want to use the default content generator.
87
+ </p>
88
+ <p>
89
+ For more information and usage, please read README file
90
+ </p>
91
+ <p>
92
+ author: Darsono Sutedja July 2008
93
+ </p>
94
+
95
+ </div>
96
+
97
+
98
+ </div>
99
+
100
+ <div id="method-list">
101
+ <h3 class="section-bar">Methods</h3>
102
+
103
+ <div class="name-list">
104
+ <a href="#M000001">included</a>&nbsp;&nbsp;
105
+ </div>
106
+ </div>
107
+
108
+ </div>
109
+
110
+
111
+ <!-- if includes -->
112
+
113
+ <div id="section">
114
+
115
+ <div id="class-list">
116
+ <h3 class="section-bar">Classes and Modules</h3>
117
+
118
+ Module <a href="Factory/ClassMethods.html" class="link">Mack::Data::Factory::ClassMethods</a><br />
119
+ Class <a href="Factory/FieldContentGenerator.html" class="link">Mack::Data::Factory::FieldContentGenerator</a><br />
120
+
121
+ </div>
122
+
123
+
124
+
125
+
126
+
127
+
128
+
129
+ <!-- if method_list -->
130
+ <div id="methods">
131
+ <h3 class="section-bar">Public Class methods</h3>
132
+
133
+ <div id="method-M000001" class="method-detail">
134
+ <a name="M000001"></a>
135
+
136
+ <div class="method-heading">
137
+ <a href="#M000001" class="method-signature">
138
+ <span class="method-name">included</span><span class="method-args">(base)</span>
139
+ </a>
140
+ </div>
141
+
142
+ <div class="method-description">
143
+ <p>
144
+ make sure the data factory API is available to the class that includes it
145
+ </p>
146
+ <p><a class="source-toggle" href="#"
147
+ onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
148
+ <div class="method-source-code" id="M000001-source">
149
+ <pre>
150
+ <span class="ruby-comment cmt"># File lib/mack-data_factory/data_factory.rb, line 18</span>
151
+ 18: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">included</span>(<span class="ruby-identifier">base</span>)
152
+ 19: <span class="ruby-identifier">base</span>.<span class="ruby-identifier">extend</span> <span class="ruby-constant">ClassMethods</span>
153
+ 20: <span class="ruby-keyword kw">end</span>
154
+ </pre>
155
+ </div>
156
+ </div>
157
+ </div>
158
+
159
+
160
+ </div>
161
+
162
+
163
+ </div>
164
+
165
+
166
+ <div id="validator-badges">
167
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
168
+ </div>
169
+
170
+ </body>
171
+ </html>
@@ -0,0 +1,262 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Module: Mack::Data::Factory::ClassMethods</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Module</strong></td>
53
+ <td class="class-name-in-header">Mack::Data::Factory::ClassMethods</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../../../files/lib/mack-data_factory/data_factory_rb.html">
59
+ lib/mack-data_factory/data_factory.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ </table>
66
+ </div>
67
+ <!-- banner header -->
68
+
69
+ <div id="bodyContent">
70
+
71
+
72
+
73
+ <div id="contextContent">
74
+
75
+
76
+
77
+ </div>
78
+
79
+ <div id="method-list">
80
+ <h3 class="section-bar">Methods</h3>
81
+
82
+ <div class="name-list">
83
+ <a href="#M000002">create</a>&nbsp;&nbsp;
84
+ <a href="#M000003">field</a>&nbsp;&nbsp;
85
+ <a href="#M000004">scope_for</a>&nbsp;&nbsp;
86
+ </div>
87
+ </div>
88
+
89
+ </div>
90
+
91
+
92
+ <!-- if includes -->
93
+
94
+ <div id="section">
95
+
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+ <!-- if method_list -->
104
+ <div id="methods">
105
+ <h3 class="section-bar">Public Instance methods</h3>
106
+
107
+ <div id="method-M000002" class="method-detail">
108
+ <a name="M000002"></a>
109
+
110
+ <div class="method-heading">
111
+ <a href="#M000002" class="method-signature">
112
+ <span class="method-name">create</span><span class="method-args">(num, scope = :default)</span>
113
+ </a>
114
+ </div>
115
+
116
+ <div class="method-description">
117
+ <p>
118
+ Run the factory to produce n number of objects.
119
+ </p>
120
+ <p>
121
+ Example: class CarFactory
122
+ </p>
123
+ <pre>
124
+ include Mack::Data::Factory
125
+ field :name, &quot;honda&quot; { |def_value, rules, index| &quot;#{def_value} #{['civic', 'accord', 'pilot'].randomize[0]}&quot;}
126
+ </pre>
127
+ <p>
128
+ end
129
+ </p>
130
+ <p>
131
+ CarFactory.create(100) #=&gt; will produce 100 cars whose name is
132
+ &quot;honda xxx&quot; where xxx is a random item from [&#8216;civic&#8217;,
133
+ &#8216;accord&#8217;, &#8216;pilot&#8217;]
134
+ </p>
135
+ <p>
136
+ params:
137
+ </p>
138
+ <ul>
139
+ <li>num - how many objects to produce
140
+
141
+ </li>
142
+ <li>scope - run the factory in a named scope
143
+
144
+ </li>
145
+ </ul>
146
+ <p><a class="source-toggle" href="#"
147
+ onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
148
+ <div class="method-source-code" id="M000002-source">
149
+ <pre>
150
+ <span class="ruby-comment cmt"># File lib/mack-data_factory/data_factory.rb, line 39</span>
151
+ 39: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create</span>(<span class="ruby-identifier">num</span>, <span class="ruby-identifier">scope</span> = <span class="ruby-identifier">:default</span>)
152
+ 40: <span class="ruby-identifier">factory_name</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">name</span>.<span class="ruby-identifier">underscore</span>
153
+ 41:
154
+ 42: <span class="ruby-comment cmt"># retrieve the model name from the factory class. </span>
155
+ 43: <span class="ruby-identifier">model_name</span> = <span class="ruby-identifier">factory_name</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">'_factory'</span>, <span class="ruby-value str">''</span>)
156
+ 44:
157
+ 45: <span class="ruby-comment cmt"># if user is running custom scope, then merge the fields </span>
158
+ 46: <span class="ruby-comment cmt"># defined for that scope with the default one, before we run the factory</span>
159
+ 47: <span class="ruby-identifier">scoped_fields</span> = <span class="ruby-identifier">field_manager</span>.<span class="ruby-identifier">scopes</span>[<span class="ruby-identifier">scope</span>]
160
+ 48: <span class="ruby-identifier">fields</span> = <span class="ruby-identifier">field_manager</span>.<span class="ruby-identifier">scopes</span>[<span class="ruby-identifier">:default</span>].<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">scoped_fields</span>)
161
+ 49:
162
+ 50: <span class="ruby-identifier">ret_arr</span> = []
163
+ 51:
164
+ 52: <span class="ruby-constant">Mack</span><span class="ruby-operator">::</span><span class="ruby-constant">Data</span><span class="ruby-operator">::</span><span class="ruby-constant">RegistryMap</span>.<span class="ruby-identifier">reset!</span>
165
+ 53: <span class="ruby-identifier">num</span>.<span class="ruby-identifier">times</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
166
+ 54: <span class="ruby-comment cmt">#puts &quot;Creating #{model_name} ##{i+1}&quot;</span>
167
+ 55: <span class="ruby-identifier">obj</span> = <span class="ruby-identifier">model_name</span>.<span class="ruby-identifier">camelcase</span>.<span class="ruby-identifier">constantize</span>.<span class="ruby-identifier">new</span>
168
+ 56:
169
+ 57: <span class="ruby-identifier">fields</span>.<span class="ruby-identifier">each_pair</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
170
+ 58: <span class="ruby-identifier">field_name</span> = <span class="ruby-identifier">k</span>.<span class="ruby-identifier">to_s</span>
171
+ 59: <span class="ruby-identifier">field_value</span> = <span class="ruby-identifier">v</span>.<span class="ruby-identifier">get_value</span>(<span class="ruby-identifier">i</span>)
172
+ 60: <span class="ruby-identifier">assert_method</span>(<span class="ruby-identifier">obj</span>, <span class="ruby-node">&quot;#{field_name}=&quot;</span>, <span class="ruby-node">&quot;#{model_name.camelcase} doesn't have #{field_name}= method!&quot;</span>) <span class="ruby-keyword kw">do</span>
173
+ 61: <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">send</span>(<span class="ruby-node">&quot;#{field_name}=&quot;</span>, <span class="ruby-identifier">field_value</span>)
174
+ 62: <span class="ruby-keyword kw">end</span>
175
+ 63: <span class="ruby-keyword kw">end</span>
176
+ 64:
177
+ 65: <span class="ruby-identifier">assert_method</span>(<span class="ruby-identifier">obj</span>, <span class="ruby-value str">&quot;save&quot;</span>, <span class="ruby-node">&quot;#{model_name.camelcase} doesn't have save method. Data will not be saved!&quot;</span>) <span class="ruby-keyword kw">do</span>
178
+ 66: <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">save</span>
179
+ 67: <span class="ruby-keyword kw">end</span>
180
+ 68:
181
+ 69: <span class="ruby-identifier">ret_arr</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">obj</span>
182
+ 70: <span class="ruby-keyword kw">end</span>
183
+ 71: <span class="ruby-constant">Mack</span><span class="ruby-operator">::</span><span class="ruby-constant">Data</span><span class="ruby-operator">::</span><span class="ruby-constant">RegistryMap</span>.<span class="ruby-identifier">reset!</span>
184
+ 72:
185
+ 73: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">ret_arr</span>[<span class="ruby-value">0</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ret_arr</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
186
+ 74: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">ret_arr</span>
187
+ 75: <span class="ruby-keyword kw">end</span>
188
+ </pre>
189
+ </div>
190
+ </div>
191
+ </div>
192
+
193
+ <div id="method-M000003" class="method-detail">
194
+ <a name="M000003"></a>
195
+
196
+ <div class="method-heading">
197
+ <a href="#M000003" class="method-signature">
198
+ <span class="method-name">field</span><span class="method-args">(model_attrib_sym, default_value, options = {}, &amp;block)</span>
199
+ </a>
200
+ </div>
201
+
202
+ <div class="method-description">
203
+ <p>
204
+ Define a <a href="ClassMethods.html#M000003">field</a> with its default
205
+ value and rules and an optional content generator for this factory
206
+ </p>
207
+ <p><a class="source-toggle" href="#"
208
+ onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
209
+ <div class="method-source-code" id="M000003-source">
210
+ <pre>
211
+ <span class="ruby-comment cmt"># File lib/mack-data_factory/data_factory.rb, line 81</span>
212
+ 81: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">field</span>(<span class="ruby-identifier">model_attrib_sym</span>, <span class="ruby-identifier">default_value</span>, <span class="ruby-identifier">options</span> = {}, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
213
+ 82: <span class="ruby-identifier">field_manager</span>.<span class="ruby-identifier">add</span>(<span class="ruby-identifier">scope</span>, <span class="ruby-identifier">model_attrib_sym</span>, <span class="ruby-identifier">default_value</span>, <span class="ruby-identifier">options</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
214
+ 83: <span class="ruby-keyword kw">end</span>
215
+ </pre>
216
+ </div>
217
+ </div>
218
+ </div>
219
+
220
+ <div id="method-M000004" class="method-detail">
221
+ <a name="M000004"></a>
222
+
223
+ <div class="method-heading">
224
+ <a href="#M000004" class="method-signature">
225
+ <span class="method-name">scope_for</span><span class="method-args">(tag) {|| ...}</span>
226
+ </a>
227
+ </div>
228
+
229
+ <div class="method-description">
230
+ <p>
231
+ Define a scope in the factory. Any <a
232
+ href="ClassMethods.html#M000003">field</a> defined in a scope will
233
+ overwrite its cousin in the default scope.
234
+ </p>
235
+ <p><a class="source-toggle" href="#"
236
+ onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
237
+ <div class="method-source-code" id="M000004-source">
238
+ <pre>
239
+ <span class="ruby-comment cmt"># File lib/mack-data_factory/data_factory.rb, line 89</span>
240
+ 89: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">scope_for</span>(<span class="ruby-identifier">tag</span>)
241
+ 90: <span class="ruby-identifier">set_scope</span>(<span class="ruby-identifier">tag</span>)
242
+ 91: <span class="ruby-keyword kw">yield</span>
243
+ 92: <span class="ruby-identifier">set_scope</span>(<span class="ruby-identifier">:default</span>)
244
+ 93: <span class="ruby-keyword kw">end</span>
245
+ </pre>
246
+ </div>
247
+ </div>
248
+ </div>
249
+
250
+
251
+ </div>
252
+
253
+
254
+ </div>
255
+
256
+
257
+ <div id="validator-badges">
258
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
259
+ </div>
260
+
261
+ </body>
262
+ </html>
@@ -0,0 +1,666 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: Mack::Data::Factory::FieldContentGenerator</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">Mack::Data::Factory::FieldContentGenerator</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../../../files/lib/mack-data_factory/content_generator_rb.html">
59
+ lib/mack-data_factory/content_generator.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ Object
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+
81
+
82
+
83
+ </div>
84
+
85
+ <div id="method-list">
86
+ <h3 class="section-bar">Methods</h3>
87
+
88
+ <div class="name-list">
89
+ <a href="#M000005">alpha_generator</a>&nbsp;&nbsp;
90
+ <a href="#M000006">alpha_numeric_generator</a>&nbsp;&nbsp;
91
+ <a href="#M000018">city_generator</a>&nbsp;&nbsp;
92
+ <a href="#M000016">company_generator</a>&nbsp;&nbsp;
93
+ <a href="#M000008">date_generator</a>&nbsp;&nbsp;
94
+ <a href="#M000009">date_time_generator</a>&nbsp;&nbsp;
95
+ <a href="#M000012">domain_generator</a>&nbsp;&nbsp;
96
+ <a href="#M000010">email_generator</a>&nbsp;&nbsp;
97
+ <a href="#M000013">firstname_generator</a>&nbsp;&nbsp;
98
+ <a href="#M000014">lastname_generator</a>&nbsp;&nbsp;
99
+ <a href="#M000017">name_generator</a>&nbsp;&nbsp;
100
+ <a href="#M000007">numeric_generator</a>&nbsp;&nbsp;
101
+ <a href="#M000015">phone_generator</a>&nbsp;&nbsp;
102
+ <a href="#M000020">state_generator</a>&nbsp;&nbsp;
103
+ <a href="#M000019">streetname_generator</a>&nbsp;&nbsp;
104
+ <a href="#M000011">username_generator</a>&nbsp;&nbsp;
105
+ <a href="#M000021">zipcode_generator</a>&nbsp;&nbsp;
106
+ </div>
107
+ </div>
108
+
109
+ </div>
110
+
111
+
112
+ <!-- if includes -->
113
+
114
+ <div id="section">
115
+
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+ <!-- if method_list -->
124
+ <div id="methods">
125
+ <h3 class="section-bar">Public Class methods</h3>
126
+
127
+ <div id="method-M000005" class="method-detail">
128
+ <a name="M000005"></a>
129
+
130
+ <div class="method-heading">
131
+ <a href="#M000005" class="method-signature">
132
+ <span class="method-name">alpha_generator</span><span class="method-args">()</span>
133
+ </a>
134
+ </div>
135
+
136
+ <div class="method-description">
137
+ <p><a class="source-toggle" href="#"
138
+ onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
139
+ <div class="method-source-code" id="M000005-source">
140
+ <pre>
141
+ <span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line 7</span>
142
+ 7: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">alpha_generator</span>
143
+ 8: <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
+ 9: <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
+ 10:
146
+ 11: <span class="ruby-identifier">length</span> = <span class="ruby-value">128</span>
147
+ 12: <span class="ruby-identifier">min_length</span> = <span class="ruby-value">-1</span>
148
+ 13: <span class="ruby-identifier">max_length</span> = <span class="ruby-value">-1</span>
149
+ 14:
150
+ 15: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rules</span>[<span class="ruby-identifier">:min_length</span>]
151
+ 16: <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
+ 17: <span class="ruby-keyword kw">end</span>
153
+ 18:
154
+ 19: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rules</span>[<span class="ruby-identifier">:max_length</span>]
155
+ 20: <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
+ 21: <span class="ruby-keyword kw">end</span>
157
+ 22:
158
+ 23: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rules</span>[<span class="ruby-identifier">:length</span>]
159
+ 24: <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
+ 25: <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">&lt;=</span> <span class="ruby-identifier">length</span>)
161
+ 26: <span class="ruby-keyword kw">end</span>
162
+ 27:
163
+ 28: <span class="ruby-identifier">ret_val</span> = <span class="ruby-value str">&quot;&quot;</span>
164
+ 29: <span class="ruby-identifier">words_size</span> = <span class="ruby-identifier">words</span>.<span class="ruby-identifier">size</span>
165
+ 30: <span class="ruby-keyword kw">until</span> <span class="ruby-identifier">ret_val</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">length</span> <span class="ruby-keyword kw">do</span>
166
+ 31: <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
+ 32: <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">&gt;</span> <span class="ruby-identifier">words_size</span>
168
+ 33:
169
+ 34: <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
+ 35: <span class="ruby-identifier">ret_val</span> <span class="ruby-operator">+=</span> <span class="ruby-value str">&quot; &quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rules</span>[<span class="ruby-identifier">:add_space</span>]
171
+ 36: <span class="ruby-keyword kw">end</span>
172
+ 37:
173
+ 38: <span class="ruby-identifier">ret_val</span>.<span class="ruby-identifier">strip!</span>
174
+ 39:
175
+ 40: <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">&gt;</span> <span class="ruby-identifier">length</span>
176
+ 41:
177
+ 42: <span class="ruby-identifier">ret_val</span>
178
+ 43: <span class="ruby-keyword kw">end</span>
179
+ 44: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@alpha_gen</span>
180
+ 45: <span class="ruby-keyword kw">end</span>
181
+ </pre>
182
+ </div>
183
+ </div>
184
+ </div>
185
+
186
+ <div id="method-M000006" class="method-detail">
187
+ <a name="M000006"></a>
188
+
189
+ <div class="method-heading">
190
+ <a href="#M000006" class="method-signature">
191
+ <span class="method-name">alpha_numeric_generator</span><span class="method-args">()</span>
192
+ </a>
193
+ </div>
194
+
195
+ <div class="method-description">
196
+ <p><a class="source-toggle" href="#"
197
+ onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
198
+ <div class="method-source-code" id="M000006-source">
199
+ <pre>
200
+ <span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line 47</span>
201
+ 47: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">alpha_numeric_generator</span>
202
+ 48: <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
+ 49: <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
+ 50:
205
+ 51: <span class="ruby-identifier">length</span> = <span class="ruby-value">128</span>
206
+ 52: <span class="ruby-identifier">min_length</span> = <span class="ruby-value">-1</span>
207
+ 53: <span class="ruby-identifier">max_length</span> = <span class="ruby-value">-1</span>
208
+ 54:
209
+ 55: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rules</span>[<span class="ruby-identifier">:min_length</span>]
210
+ 56: <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
+ 57: <span class="ruby-keyword kw">end</span>
212
+ 58:
213
+ 59: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rules</span>[<span class="ruby-identifier">:max_length</span>]
214
+ 60: <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
+ 61: <span class="ruby-keyword kw">end</span>
216
+ 62:
217
+ 63: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rules</span>[<span class="ruby-identifier">:length</span>]
218
+ 64: <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
+ 65: <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">&lt;=</span> <span class="ruby-identifier">length</span>)
220
+ 66: <span class="ruby-keyword kw">end</span>
221
+ 67:
222
+ 68: <span class="ruby-identifier">ret_val</span> = <span class="ruby-value str">&quot;&quot;</span>
223
+ 69: <span class="ruby-identifier">words_size</span> = <span class="ruby-identifier">words</span>.<span class="ruby-identifier">size</span>
224
+ 70: <span class="ruby-keyword kw">until</span> <span class="ruby-identifier">ret_val</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">length</span> <span class="ruby-keyword kw">do</span>
225
+ 71: <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
+ 72: <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">&gt;</span> <span class="ruby-identifier">words_size</span>
227
+ 73:
228
+ 74: <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
+ 75: <span class="ruby-identifier">ret_val</span> <span class="ruby-operator">+=</span> <span class="ruby-value str">&quot; &quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rules</span>[<span class="ruby-identifier">:add_space</span>]
230
+ 76: <span class="ruby-keyword kw">end</span>
231
+ 77:
232
+ 78: <span class="ruby-identifier">ret_val</span>.<span class="ruby-identifier">strip!</span>
233
+ 79:
234
+ 80: <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">&gt;</span> <span class="ruby-identifier">length</span>
235
+ 81:
236
+ 82: <span class="ruby-identifier">ret_val</span>
237
+ 83: <span class="ruby-keyword kw">end</span>
238
+ 84: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@alpha_numeric_gen</span>
239
+ 85: <span class="ruby-keyword kw">end</span>
240
+ </pre>
241
+ </div>
242
+ </div>
243
+ </div>
244
+
245
+ <div id="method-M000018" class="method-detail">
246
+ <a name="M000018"></a>
247
+
248
+ <div class="method-heading">
249
+ <a href="#M000018" class="method-signature">
250
+ <span class="method-name">city_generator</span><span class="method-args">()</span>
251
+ </a>
252
+ </div>
253
+
254
+ <div class="method-description">
255
+ <p>
256
+ Address Generators
257
+ </p>
258
+ <p><a class="source-toggle" href="#"
259
+ onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
260
+ <div class="method-source-code" id="M000018-source">
261
+ <pre>
262
+ <span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line 177</span>
263
+ 177: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">city_generator</span>
264
+ 178: <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
+ 179: <span class="ruby-constant">Faker</span><span class="ruby-operator">::</span><span class="ruby-constant">Address</span>.<span class="ruby-identifier">city</span>
266
+ 180: <span class="ruby-keyword kw">end</span>
267
+ 181: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@city_gen</span>
268
+ 182: <span class="ruby-keyword kw">end</span>
269
+ </pre>
270
+ </div>
271
+ </div>
272
+ </div>
273
+
274
+ <div id="method-M000016" class="method-detail">
275
+ <a name="M000016"></a>
276
+
277
+ <div class="method-heading">
278
+ <a href="#M000016" class="method-signature">
279
+ <span class="method-name">company_generator</span><span class="method-args">()</span>
280
+ </a>
281
+ </div>
282
+
283
+ <div class="method-description">
284
+ <p><a class="source-toggle" href="#"
285
+ onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
286
+ <div class="method-source-code" id="M000016-source">
287
+ <pre>
288
+ <span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line 155</span>
289
+ 155: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">company_generator</span>
290
+ 156: <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
+ 157: <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
+ 158:
293
+ 159: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rules</span>[<span class="ruby-identifier">:include_bs</span>]
294
+ 160: <span class="ruby-identifier">str</span> <span class="ruby-operator">+=</span> <span class="ruby-node">&quot;\n#{Faker::Company.bs}&quot;</span>
295
+ 161: <span class="ruby-keyword kw">end</span>
296
+ 162:
297
+ 163: <span class="ruby-identifier">str</span>
298
+ 164: <span class="ruby-keyword kw">end</span>
299
+ 165: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@company_gen</span>
300
+ 166: <span class="ruby-keyword kw">end</span>
301
+ </pre>
302
+ </div>
303
+ </div>
304
+ </div>
305
+
306
+ <div id="method-M000008" class="method-detail">
307
+ <a name="M000008"></a>
308
+
309
+ <div class="method-heading">
310
+ <a href="#M000008" class="method-signature">
311
+ <span class="method-name">date_generator</span><span class="method-args">()</span>
312
+ </a>
313
+ </div>
314
+
315
+ <div class="method-description">
316
+ <p><a class="source-toggle" href="#"
317
+ onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
318
+ <div class="method-source-code" id="M000008-source">
319
+ <pre>
320
+ <span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line 98</span>
321
+ 98: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">date_generator</span>
322
+ 99: <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>
323
+ 100: <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>.<span class="ruby-identifier">to_s</span>
324
+ 101: <span class="ruby-keyword kw">end</span>
325
+ 102: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@date_gen</span>
326
+ 103: <span class="ruby-keyword kw">end</span>
327
+ </pre>
328
+ </div>
329
+ </div>
330
+ </div>
331
+
332
+ <div id="method-M000009" class="method-detail">
333
+ <a name="M000009"></a>
334
+
335
+ <div class="method-heading">
336
+ <a href="#M000009" class="method-signature">
337
+ <span class="method-name">date_time_generator</span><span class="method-args">()</span>
338
+ </a>
339
+ </div>
340
+
341
+ <div class="method-description">
342
+ <p><a class="source-toggle" href="#"
343
+ onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
344
+ <div class="method-source-code" id="M000009-source">
345
+ <pre>
346
+ <span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line 105</span>
347
+ 105: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">date_time_generator</span>
348
+ 106: <span class="ruby-ivar">@date_time_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
+ 107: <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>.<span class="ruby-identifier">to_s</span>
350
+ 108: <span class="ruby-keyword kw">end</span>
351
+ 109: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@date_time_gen</span>
352
+ 110: <span class="ruby-keyword kw">end</span>
353
+ </pre>
354
+ </div>
355
+ </div>
356
+ </div>
357
+
358
+ <div id="method-M000012" class="method-detail">
359
+ <a name="M000012"></a>
360
+
361
+ <div class="method-heading">
362
+ <a href="#M000012" class="method-signature">
363
+ <span class="method-name">domain_generator</span><span class="method-args">()</span>
364
+ </a>
365
+ </div>
366
+
367
+ <div class="method-description">
368
+ <p><a class="source-toggle" href="#"
369
+ onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
370
+ <div class="method-source-code" id="M000012-source">
371
+ <pre>
372
+ <span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line 127</span>
373
+ 127: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">domain_generator</span>
374
+ 128: <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>
375
+ 129: <span class="ruby-constant">Faker</span><span class="ruby-operator">::</span><span class="ruby-constant">Internet</span>.<span class="ruby-identifier">domain_name</span>
376
+ 130: <span class="ruby-keyword kw">end</span>
377
+ 131: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@domain_gen</span>
378
+ 132: <span class="ruby-keyword kw">end</span>
379
+ </pre>
380
+ </div>
381
+ </div>
382
+ </div>
383
+
384
+ <div id="method-M000010" class="method-detail">
385
+ <a name="M000010"></a>
386
+
387
+ <div class="method-heading">
388
+ <a href="#M000010" class="method-signature">
389
+ <span class="method-name">email_generator</span><span class="method-args">()</span>
390
+ </a>
391
+ </div>
392
+
393
+ <div class="method-description">
394
+ <p><a class="source-toggle" href="#"
395
+ onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
396
+ <div class="method-source-code" id="M000010-source">
397
+ <pre>
398
+ <span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line 113</span>
399
+ 113: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">email_generator</span>
400
+ 114: <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>
401
+ 115: <span class="ruby-constant">Faker</span><span class="ruby-operator">::</span><span class="ruby-constant">Internet</span>.<span class="ruby-identifier">free_email</span>
402
+ 116: <span class="ruby-keyword kw">end</span>
403
+ 117: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@email_gen</span>
404
+ 118: <span class="ruby-keyword kw">end</span>
405
+ </pre>
406
+ </div>
407
+ </div>
408
+ </div>
409
+
410
+ <div id="method-M000013" class="method-detail">
411
+ <a name="M000013"></a>
412
+
413
+ <div class="method-heading">
414
+ <a href="#M000013" class="method-signature">
415
+ <span class="method-name">firstname_generator</span><span class="method-args">()</span>
416
+ </a>
417
+ </div>
418
+
419
+ <div class="method-description">
420
+ <p><a class="source-toggle" href="#"
421
+ onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
422
+ <div class="method-source-code" id="M000013-source">
423
+ <pre>
424
+ <span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line 134</span>
425
+ 134: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">firstname_generator</span>
426
+ 135: <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>
427
+ 136: <span class="ruby-constant">Faker</span><span class="ruby-operator">::</span><span class="ruby-constant">Name</span>.<span class="ruby-identifier">first_name</span>
428
+ 137: <span class="ruby-keyword kw">end</span>
429
+ 138: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@fn_gen</span>
430
+ 139: <span class="ruby-keyword kw">end</span>
431
+ </pre>
432
+ </div>
433
+ </div>
434
+ </div>
435
+
436
+ <div id="method-M000014" class="method-detail">
437
+ <a name="M000014"></a>
438
+
439
+ <div class="method-heading">
440
+ <a href="#M000014" class="method-signature">
441
+ <span class="method-name">lastname_generator</span><span class="method-args">()</span>
442
+ </a>
443
+ </div>
444
+
445
+ <div class="method-description">
446
+ <p><a class="source-toggle" href="#"
447
+ onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
448
+ <div class="method-source-code" id="M000014-source">
449
+ <pre>
450
+ <span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line 141</span>
451
+ 141: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">lastname_generator</span>
452
+ 142: <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>
453
+ 143: <span class="ruby-constant">Faker</span><span class="ruby-operator">::</span><span class="ruby-constant">Name</span>.<span class="ruby-identifier">last_name</span>
454
+ 144: <span class="ruby-keyword kw">end</span>
455
+ 145: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@ln_gen</span>
456
+ 146: <span class="ruby-keyword kw">end</span>
457
+ </pre>
458
+ </div>
459
+ </div>
460
+ </div>
461
+
462
+ <div id="method-M000017" class="method-detail">
463
+ <a name="M000017"></a>
464
+
465
+ <div class="method-heading">
466
+ <a href="#M000017" class="method-signature">
467
+ <span class="method-name">name_generator</span><span class="method-args">()</span>
468
+ </a>
469
+ </div>
470
+
471
+ <div class="method-description">
472
+ <p><a class="source-toggle" href="#"
473
+ onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
474
+ <div class="method-source-code" id="M000017-source">
475
+ <pre>
476
+ <span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line 168</span>
477
+ 168: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">name_generator</span>
478
+ 169: <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>
479
+ 170: <span class="ruby-constant">Faker</span><span class="ruby-operator">::</span><span class="ruby-constant">Name</span>.<span class="ruby-identifier">name</span>
480
+ 171: <span class="ruby-keyword kw">end</span>
481
+ 172: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@name_gen</span>
482
+ 173: <span class="ruby-keyword kw">end</span>
483
+ </pre>
484
+ </div>
485
+ </div>
486
+ </div>
487
+
488
+ <div id="method-M000007" class="method-detail">
489
+ <a name="M000007"></a>
490
+
491
+ <div class="method-heading">
492
+ <a href="#M000007" class="method-signature">
493
+ <span class="method-name">numeric_generator</span><span class="method-args">()</span>
494
+ </a>
495
+ </div>
496
+
497
+ <div class="method-description">
498
+ <p><a class="source-toggle" href="#"
499
+ onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
500
+ <div class="method-source-code" id="M000007-source">
501
+ <pre>
502
+ <span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line 87</span>
503
+ 87: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">numeric_generator</span>
504
+ 88: <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>
505
+ 89: <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>
506
+ 90: <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>
507
+ 91:
508
+ 92: <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>]
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>
513
+ </pre>
514
+ </div>
515
+ </div>
516
+ </div>
517
+
518
+ <div id="method-M000015" class="method-detail">
519
+ <a name="M000015"></a>
520
+
521
+ <div class="method-heading">
522
+ <a href="#M000015" class="method-signature">
523
+ <span class="method-name">phone_generator</span><span class="method-args">()</span>
524
+ </a>
525
+ </div>
526
+
527
+ <div class="method-description">
528
+ <p><a class="source-toggle" href="#"
529
+ onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
530
+ <div class="method-source-code" id="M000015-source">
531
+ <pre>
532
+ <span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line 148</span>
533
+ 148: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">phone_generator</span>
534
+ 149: <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>
535
+ 150: <span class="ruby-constant">Faker</span><span class="ruby-operator">::</span><span class="ruby-constant">PhoneNumber</span>.<span class="ruby-identifier">phone_number</span>
536
+ 151: <span class="ruby-keyword kw">end</span>
537
+ 152: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@phone_gen</span>
538
+ 153: <span class="ruby-keyword kw">end</span>
539
+ </pre>
540
+ </div>
541
+ </div>
542
+ </div>
543
+
544
+ <div id="method-M000020" class="method-detail">
545
+ <a name="M000020"></a>
546
+
547
+ <div class="method-heading">
548
+ <a href="#M000020" class="method-signature">
549
+ <span class="method-name">state_generator</span><span class="method-args">()</span>
550
+ </a>
551
+ </div>
552
+
553
+ <div class="method-description">
554
+ <p><a class="source-toggle" href="#"
555
+ onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
556
+ <div class="method-source-code" id="M000020-source">
557
+ <pre>
558
+ <span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line 191</span>
559
+ 191: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">state_generator</span>
560
+ 192: <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>
561
+ 193: <span class="ruby-identifier">supported_countries</span> = [<span class="ruby-identifier">:us</span>, <span class="ruby-identifier">:uk</span>]
562
+ 194: <span class="ruby-identifier">us_or_uk</span> = <span class="ruby-identifier">:us</span>
563
+ 195: <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>
564
+ 196: <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">&quot;_abbr&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-value str">&quot;&quot;</span>
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">&quot;#{us_or_uk.to_s}_state#{abbr}&quot;</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>
569
+ </pre>
570
+ </div>
571
+ </div>
572
+ </div>
573
+
574
+ <div id="method-M000019" class="method-detail">
575
+ <a name="M000019"></a>
576
+
577
+ <div class="method-heading">
578
+ <a href="#M000019" class="method-signature">
579
+ <span class="method-name">streetname_generator</span><span class="method-args">()</span>
580
+ </a>
581
+ </div>
582
+
583
+ <div class="method-description">
584
+ <p><a class="source-toggle" href="#"
585
+ onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
586
+ <div class="method-source-code" id="M000019-source">
587
+ <pre>
588
+ <span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line 184</span>
589
+ 184: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">streetname_generator</span>
590
+ 185: <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>
591
+ 186: <span class="ruby-constant">Faker</span><span class="ruby-operator">::</span><span class="ruby-constant">Address</span>.<span class="ruby-identifier">street_name</span>
592
+ 187: <span class="ruby-keyword kw">end</span>
593
+ 188: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@sn_gen</span>
594
+ 189: <span class="ruby-keyword kw">end</span>
595
+ </pre>
596
+ </div>
597
+ </div>
598
+ </div>
599
+
600
+ <div id="method-M000011" class="method-detail">
601
+ <a name="M000011"></a>
602
+
603
+ <div class="method-heading">
604
+ <a href="#M000011" class="method-signature">
605
+ <span class="method-name">username_generator</span><span class="method-args">()</span>
606
+ </a>
607
+ </div>
608
+
609
+ <div class="method-description">
610
+ <p><a class="source-toggle" href="#"
611
+ onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
612
+ <div class="method-source-code" id="M000011-source">
613
+ <pre>
614
+ <span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line 120</span>
615
+ 120: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">username_generator</span>
616
+ 121: <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>
617
+ 122: <span class="ruby-constant">Faker</span><span class="ruby-operator">::</span><span class="ruby-constant">Internet</span>.<span class="ruby-identifier">user_name</span>
618
+ 123: <span class="ruby-keyword kw">end</span>
619
+ 124: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@username_gen</span>
620
+ 125: <span class="ruby-keyword kw">end</span>
621
+ </pre>
622
+ </div>
623
+ </div>
624
+ </div>
625
+
626
+ <div id="method-M000021" class="method-detail">
627
+ <a name="M000021"></a>
628
+
629
+ <div class="method-heading">
630
+ <a href="#M000021" class="method-signature">
631
+ <span class="method-name">zipcode_generator</span><span class="method-args">()</span>
632
+ </a>
633
+ </div>
634
+
635
+ <div class="method-description">
636
+ <p><a class="source-toggle" href="#"
637
+ onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
638
+ <div class="method-source-code" id="M000021-source">
639
+ <pre>
640
+ <span class="ruby-comment cmt"># File lib/mack-data_factory/content_generator.rb, line 202</span>
641
+ 202: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">zipcode_generator</span>
642
+ 203: <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>
643
+ 204: <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>
644
+ 205: <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>
645
+ 206: <span class="ruby-identifier">ret_val</span>
646
+ 207: <span class="ruby-keyword kw">end</span>
647
+ 208: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@zip_gen</span>
648
+ 209: <span class="ruby-keyword kw">end</span>
649
+ </pre>
650
+ </div>
651
+ </div>
652
+ </div>
653
+
654
+
655
+ </div>
656
+
657
+
658
+ </div>
659
+
660
+
661
+ <div id="validator-badges">
662
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
663
+ </div>
664
+
665
+ </body>
666
+ </html>