X12 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +13 -0
- data/COPYING +502 -0
- data/README +309 -0
- data/Rakefile +157 -0
- data/TODO +6 -0
- data/doc/classes/X12.html +174 -0
- data/doc/classes/X12/Base.html +677 -0
- data/doc/classes/X12/Composite.html +156 -0
- data/doc/classes/X12/Empty.html +186 -0
- data/doc/classes/X12/Field.html +339 -0
- data/doc/classes/X12/Loop.html +202 -0
- data/doc/classes/X12/Parser.html +306 -0
- data/doc/classes/X12/Segment.html +277 -0
- data/doc/classes/X12/Table.html +198 -0
- data/doc/created.rid +1 -0
- data/doc/files/CHANGELOG.html +108 -0
- data/doc/files/README.html +474 -0
- data/doc/files/TODO.html +95 -0
- data/doc/files/lib/X12/Base_rb.html +83 -0
- data/doc/files/lib/X12/Composite_rb.html +83 -0
- data/doc/files/lib/X12/Empty_rb.html +83 -0
- data/doc/files/lib/X12/Field_rb.html +83 -0
- data/doc/files/lib/X12/Loop_rb.html +83 -0
- data/doc/files/lib/X12/Parser_rb.html +83 -0
- data/doc/files/lib/X12/Segment_rb.html +83 -0
- data/doc/files/lib/X12/Table_rb.html +83 -0
- data/doc/files/lib/X12_rb.html +100 -0
- data/doc/fr_class_index.html +35 -0
- data/doc/fr_file_index.html +38 -0
- data/doc/fr_method_index.html +62 -0
- data/doc/index.html +27 -0
- data/doc/rdoc-style.css +208 -0
- data/example/factory.rb +92 -0
- data/example/parse.rb +56 -0
- data/lib/X12.rb +50 -0
- data/lib/X12/Base.rb +192 -0
- data/lib/X12/Composite.rb +37 -0
- data/lib/X12/Empty.rb +43 -0
- data/lib/X12/Field.rb +81 -0
- data/lib/X12/Loop.rb +74 -0
- data/lib/X12/Parser.rb +98 -0
- data/lib/X12/Segment.rb +92 -0
- data/lib/X12/Table.rb +44 -0
- data/lib/X12/x12syntax.treetop +256 -0
- data/misc/997.d12 +885 -0
- data/misc/rdoc_template.rb +697 -0
- data/test/tc_factory_997.rb +130 -0
- data/test/tc_parse_997.rb +146 -0
- data/test/ts_x12.rb +27 -0
- metadata +108 -0
data/TODO
ADDED
@@ -0,0 +1,174 @@
|
|
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: X12</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">X12</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../files/lib/X12/Base_rb.html">
|
59
|
+
lib/X12/Base.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
<a href="../files/lib/X12/Composite_rb.html">
|
63
|
+
lib/X12/Composite.rb
|
64
|
+
</a>
|
65
|
+
<br />
|
66
|
+
<a href="../files/lib/X12/Empty_rb.html">
|
67
|
+
lib/X12/Empty.rb
|
68
|
+
</a>
|
69
|
+
<br />
|
70
|
+
<a href="../files/lib/X12/Field_rb.html">
|
71
|
+
lib/X12/Field.rb
|
72
|
+
</a>
|
73
|
+
<br />
|
74
|
+
<a href="../files/lib/X12/Loop_rb.html">
|
75
|
+
lib/X12/Loop.rb
|
76
|
+
</a>
|
77
|
+
<br />
|
78
|
+
<a href="../files/lib/X12/Parser_rb.html">
|
79
|
+
lib/X12/Parser.rb
|
80
|
+
</a>
|
81
|
+
<br />
|
82
|
+
<a href="../files/lib/X12/Segment_rb.html">
|
83
|
+
lib/X12/Segment.rb
|
84
|
+
</a>
|
85
|
+
<br />
|
86
|
+
<a href="../files/lib/X12/Table_rb.html">
|
87
|
+
lib/X12/Table.rb
|
88
|
+
</a>
|
89
|
+
<br />
|
90
|
+
<a href="../files/lib/X12_rb.html">
|
91
|
+
lib/X12.rb
|
92
|
+
</a>
|
93
|
+
<br />
|
94
|
+
</td>
|
95
|
+
</tr>
|
96
|
+
|
97
|
+
</table>
|
98
|
+
</div>
|
99
|
+
<!-- banner header -->
|
100
|
+
|
101
|
+
<div id="bodyContent">
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
<div id="contextContent">
|
106
|
+
|
107
|
+
<div id="description">
|
108
|
+
<p>
|
109
|
+
$Id: X12.rb 35 2008-11-13 18:33:44Z ikk $
|
110
|
+
</p>
|
111
|
+
<p>
|
112
|
+
Package implementing direct manipulation of <a href="X12.html">X12</a>
|
113
|
+
structures using Ruby syntax.
|
114
|
+
</p>
|
115
|
+
|
116
|
+
</div>
|
117
|
+
|
118
|
+
|
119
|
+
</div>
|
120
|
+
|
121
|
+
|
122
|
+
</div>
|
123
|
+
|
124
|
+
|
125
|
+
<!-- if includes -->
|
126
|
+
|
127
|
+
<div id="section">
|
128
|
+
|
129
|
+
<div id="class-list">
|
130
|
+
<h3 class="section-bar">Classes and Modules</h3>
|
131
|
+
|
132
|
+
Class <a href="X12/Base.html" class="link">X12::Base</a><br />
|
133
|
+
Class <a href="X12/Composite.html" class="link">X12::Composite</a><br />
|
134
|
+
Class <a href="X12/Empty.html" class="link">X12::Empty</a><br />
|
135
|
+
Class <a href="X12/Field.html" class="link">X12::Field</a><br />
|
136
|
+
Class <a href="X12/Loop.html" class="link">X12::Loop</a><br />
|
137
|
+
Class <a href="X12/Parser.html" class="link">X12::Parser</a><br />
|
138
|
+
Class <a href="X12/Segment.html" class="link">X12::Segment</a><br />
|
139
|
+
Class <a href="X12/Table.html" class="link">X12::Table</a><br />
|
140
|
+
|
141
|
+
</div>
|
142
|
+
|
143
|
+
<div id="constants-list">
|
144
|
+
<h3 class="section-bar">Constants</h3>
|
145
|
+
|
146
|
+
<div class="name-list">
|
147
|
+
<table summary="Constants">
|
148
|
+
<tr class="top-aligned-row context-row">
|
149
|
+
<td class="context-item-name">VERSION</td>
|
150
|
+
<td>=</td>
|
151
|
+
<td class="context-item-value">'0.0.5'</td>
|
152
|
+
</tr>
|
153
|
+
<tr class="top-aligned-row context-row">
|
154
|
+
<td class="context-item-name">EMPTY</td>
|
155
|
+
<td>=</td>
|
156
|
+
<td class="context-item-value">Empty.new()</td>
|
157
|
+
</tr>
|
158
|
+
</table>
|
159
|
+
</div>
|
160
|
+
</div>
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
<!-- if method_list -->
|
168
|
+
|
169
|
+
|
170
|
+
</div>
|
171
|
+
|
172
|
+
|
173
|
+
</body>
|
174
|
+
</html>
|
@@ -0,0 +1,677 @@
|
|
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: X12::Base</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">X12::Base</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/X12/Base_rb.html">
|
59
|
+
lib/X12/Base.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
|
+
<div id="description">
|
82
|
+
<p>
|
83
|
+
$Id: Base.rb 35 2008-11-13 18:33:44Z ikk $
|
84
|
+
</p>
|
85
|
+
<p>
|
86
|
+
<a href="Base.html">Base</a> class for <a href="Segment.html">Segment</a>,
|
87
|
+
<a href="Composite.html">Composite</a>, and <a href="Loop.html">Loop</a>.
|
88
|
+
Contains setable segment_separator, field_separator, and
|
89
|
+
composite_separator fields.
|
90
|
+
</p>
|
91
|
+
|
92
|
+
</div>
|
93
|
+
|
94
|
+
|
95
|
+
</div>
|
96
|
+
|
97
|
+
<div id="method-list">
|
98
|
+
<h3 class="section-bar">Methods</h3>
|
99
|
+
|
100
|
+
<div class="name-list">
|
101
|
+
<a href="#M000026">[]</a>
|
102
|
+
<a href="#M000019">do_repeats</a>
|
103
|
+
<a href="#M000021">dup</a>
|
104
|
+
<a href="#M000022">find</a>
|
105
|
+
<a href="#M000028">has_content?</a>
|
106
|
+
<a href="#M000017">inspect</a>
|
107
|
+
<a href="#M000025">method_missing</a>
|
108
|
+
<a href="#M000016">new</a>
|
109
|
+
<a href="#M000029">repeat</a>
|
110
|
+
<a href="#M000020">set_empty!</a>
|
111
|
+
<a href="#M000018">show</a>
|
112
|
+
<a href="#M000027">size</a>
|
113
|
+
<a href="#M000023">to_a</a>
|
114
|
+
<a href="#M000024">to_s</a>
|
115
|
+
</div>
|
116
|
+
</div>
|
117
|
+
|
118
|
+
</div>
|
119
|
+
|
120
|
+
|
121
|
+
<!-- if includes -->
|
122
|
+
|
123
|
+
<div id="section">
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
<div id="attribute-list">
|
130
|
+
<h3 class="section-bar">Attributes</h3>
|
131
|
+
|
132
|
+
<div class="name-list">
|
133
|
+
<table>
|
134
|
+
<tr class="top-aligned-row context-row">
|
135
|
+
<td class="context-item-name">composite_separator</td>
|
136
|
+
<td class="context-item-value"> [W] </td>
|
137
|
+
<td class="context-item-desc"></td>
|
138
|
+
</tr>
|
139
|
+
<tr class="top-aligned-row context-row">
|
140
|
+
<td class="context-item-name">composite_separator</td>
|
141
|
+
<td class="context-item-value"> [R] </td>
|
142
|
+
<td class="context-item-desc"></td>
|
143
|
+
</tr>
|
144
|
+
<tr class="top-aligned-row context-row">
|
145
|
+
<td class="context-item-name">field_separator</td>
|
146
|
+
<td class="context-item-value"> [W] </td>
|
147
|
+
<td class="context-item-desc"></td>
|
148
|
+
</tr>
|
149
|
+
<tr class="top-aligned-row context-row">
|
150
|
+
<td class="context-item-name">field_separator</td>
|
151
|
+
<td class="context-item-value"> [R] </td>
|
152
|
+
<td class="context-item-desc"></td>
|
153
|
+
</tr>
|
154
|
+
<tr class="top-aligned-row context-row">
|
155
|
+
<td class="context-item-name">name</td>
|
156
|
+
<td class="context-item-value"> [R] </td>
|
157
|
+
<td class="context-item-desc"></td>
|
158
|
+
</tr>
|
159
|
+
<tr class="top-aligned-row context-row">
|
160
|
+
<td class="context-item-name">next_repeat</td>
|
161
|
+
<td class="context-item-value"> [R] </td>
|
162
|
+
<td class="context-item-desc"></td>
|
163
|
+
</tr>
|
164
|
+
<tr class="top-aligned-row context-row">
|
165
|
+
<td class="context-item-name">next_repeat</td>
|
166
|
+
<td class="context-item-value"> [W] </td>
|
167
|
+
<td class="context-item-desc"></td>
|
168
|
+
</tr>
|
169
|
+
<tr class="top-aligned-row context-row">
|
170
|
+
<td class="context-item-name">nodes</td>
|
171
|
+
<td class="context-item-value"> [R] </td>
|
172
|
+
<td class="context-item-desc"></td>
|
173
|
+
</tr>
|
174
|
+
<tr class="top-aligned-row context-row">
|
175
|
+
<td class="context-item-name">nodes</td>
|
176
|
+
<td class="context-item-value"> [W] </td>
|
177
|
+
<td class="context-item-desc"></td>
|
178
|
+
</tr>
|
179
|
+
<tr class="top-aligned-row context-row">
|
180
|
+
<td class="context-item-name">parsed_str</td>
|
181
|
+
<td class="context-item-value"> [R] </td>
|
182
|
+
<td class="context-item-desc"></td>
|
183
|
+
</tr>
|
184
|
+
<tr class="top-aligned-row context-row">
|
185
|
+
<td class="context-item-name">parsed_str</td>
|
186
|
+
<td class="context-item-value"> [W] </td>
|
187
|
+
<td class="context-item-desc"></td>
|
188
|
+
</tr>
|
189
|
+
<tr class="top-aligned-row context-row">
|
190
|
+
<td class="context-item-name">repeats</td>
|
191
|
+
<td class="context-item-value"> [R] </td>
|
192
|
+
<td class="context-item-desc"></td>
|
193
|
+
</tr>
|
194
|
+
<tr class="top-aligned-row context-row">
|
195
|
+
<td class="context-item-name">segment_separator</td>
|
196
|
+
<td class="context-item-value"> [R] </td>
|
197
|
+
<td class="context-item-desc"></td>
|
198
|
+
</tr>
|
199
|
+
<tr class="top-aligned-row context-row">
|
200
|
+
<td class="context-item-name">segment_separator</td>
|
201
|
+
<td class="context-item-value"> [W] </td>
|
202
|
+
<td class="context-item-desc"></td>
|
203
|
+
</tr>
|
204
|
+
</table>
|
205
|
+
</div>
|
206
|
+
</div>
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
<!-- if method_list -->
|
211
|
+
<div id="methods">
|
212
|
+
<h3 class="section-bar">Public Class methods</h3>
|
213
|
+
|
214
|
+
<div id="method-M000016" class="method-detail">
|
215
|
+
<a name="M000016"></a>
|
216
|
+
|
217
|
+
<div class="method-heading">
|
218
|
+
<a href="#M000016" class="method-signature">
|
219
|
+
<span class="method-name">new</span><span class="method-args">(name, arr, repeats = nil)</span>
|
220
|
+
</a>
|
221
|
+
</div>
|
222
|
+
|
223
|
+
<div class="method-description">
|
224
|
+
<p>
|
225
|
+
Creates a <a href="Base.html#M000016">new</a> base element with a given
|
226
|
+
name, array of sub-elements, and array of repeats if any.
|
227
|
+
</p>
|
228
|
+
<p><a class="source-toggle" href="#"
|
229
|
+
onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
|
230
|
+
<div class="method-source-code" id="M000016-source">
|
231
|
+
<pre>
|
232
|
+
<span class="ruby-comment cmt"># File lib/X12/Base.rb, line 38</span>
|
233
|
+
38: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">arr</span>, <span class="ruby-identifier">repeats</span> = <span class="ruby-keyword kw">nil</span>)
|
234
|
+
39: <span class="ruby-ivar">@nodes</span> = <span class="ruby-identifier">arr</span>
|
235
|
+
40: <span class="ruby-ivar">@name</span> = <span class="ruby-identifier">name</span>
|
236
|
+
41: <span class="ruby-ivar">@repeats</span> = <span class="ruby-identifier">repeats</span>
|
237
|
+
42: <span class="ruby-ivar">@next_repeat</span> = <span class="ruby-keyword kw">nil</span> <span class="ruby-comment cmt"># Next repeat of the same element, if any</span>
|
238
|
+
43: <span class="ruby-ivar">@parsed_str</span> = <span class="ruby-keyword kw">nil</span>
|
239
|
+
44:
|
240
|
+
45: <span class="ruby-ivar">@segment_separator</span> = <span class="ruby-value str">'~'</span>
|
241
|
+
46: <span class="ruby-ivar">@field_separator</span> = <span class="ruby-value str">'*'</span>
|
242
|
+
47: <span class="ruby-ivar">@composite_separator</span> = <span class="ruby-value str">':'</span>
|
243
|
+
48:
|
244
|
+
49: <span class="ruby-comment cmt">#puts "Created #{name} #{object_id} #{self.class} "</span>
|
245
|
+
50: <span class="ruby-keyword kw">end</span>
|
246
|
+
</pre>
|
247
|
+
</div>
|
248
|
+
</div>
|
249
|
+
</div>
|
250
|
+
|
251
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
252
|
+
|
253
|
+
<div id="method-M000026" class="method-detail">
|
254
|
+
<a name="M000026"></a>
|
255
|
+
|
256
|
+
<div class="method-heading">
|
257
|
+
<a href="#M000026" class="method-signature">
|
258
|
+
<span class="method-name">[]</span><span class="method-args">(*args)</span>
|
259
|
+
</a>
|
260
|
+
</div>
|
261
|
+
|
262
|
+
<div class="method-description">
|
263
|
+
<p>
|
264
|
+
The main method implementing Ruby-like access methods for repeating
|
265
|
+
elements
|
266
|
+
</p>
|
267
|
+
<p><a class="source-toggle" href="#"
|
268
|
+
onclick="toggleCode('M000026-source');return false;">[Source]</a></p>
|
269
|
+
<div class="method-source-code" id="M000026-source">
|
270
|
+
<pre>
|
271
|
+
<span class="ruby-comment cmt"># File lib/X12/Base.rb, line 164</span>
|
272
|
+
164: <span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
273
|
+
165: <span class="ruby-comment cmt">#puts "squares #{args.inspect}"</span>
|
274
|
+
166: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_a</span>[<span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>]] <span class="ruby-operator">||</span> <span class="ruby-constant">EMPTY</span>
|
275
|
+
167: <span class="ruby-keyword kw">end</span>
|
276
|
+
</pre>
|
277
|
+
</div>
|
278
|
+
</div>
|
279
|
+
</div>
|
280
|
+
|
281
|
+
<div id="method-M000019" class="method-detail">
|
282
|
+
<a name="M000019"></a>
|
283
|
+
|
284
|
+
<div class="method-heading">
|
285
|
+
<a href="#M000019" class="method-signature">
|
286
|
+
<span class="method-name">do_repeats</span><span class="method-args">(s)</span>
|
287
|
+
</a>
|
288
|
+
</div>
|
289
|
+
|
290
|
+
<div class="method-description">
|
291
|
+
<p>
|
292
|
+
Try to parse the current element one more time if required. Returns the
|
293
|
+
rest of the string or the same string if no more repeats are found or
|
294
|
+
required.
|
295
|
+
</p>
|
296
|
+
<p><a class="source-toggle" href="#"
|
297
|
+
onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
|
298
|
+
<div class="method-source-code" id="M000019-source">
|
299
|
+
<pre>
|
300
|
+
<span class="ruby-comment cmt"># File lib/X12/Base.rb, line 75</span>
|
301
|
+
75: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">do_repeats</span>(<span class="ruby-identifier">s</span>)
|
302
|
+
76: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">repeats</span>.<span class="ruby-identifier">end</span> <span class="ruby-operator">></span> <span class="ruby-value">1</span>
|
303
|
+
77: <span class="ruby-identifier">possible_repeat</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>
|
304
|
+
78: <span class="ruby-identifier">p_s</span> = <span class="ruby-identifier">possible_repeat</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">s</span>)
|
305
|
+
79: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">p_s</span>
|
306
|
+
80: <span class="ruby-identifier">s</span> = <span class="ruby-identifier">p_s</span>
|
307
|
+
81: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">next_repeat</span> = <span class="ruby-identifier">possible_repeat</span>
|
308
|
+
82: <span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt"># if parsed</span>
|
309
|
+
83: <span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt"># more repeats</span>
|
310
|
+
84: <span class="ruby-identifier">s</span>
|
311
|
+
85: <span class="ruby-keyword kw">end</span>
|
312
|
+
</pre>
|
313
|
+
</div>
|
314
|
+
</div>
|
315
|
+
</div>
|
316
|
+
|
317
|
+
<div id="method-M000021" class="method-detail">
|
318
|
+
<a name="M000021"></a>
|
319
|
+
|
320
|
+
<div class="method-heading">
|
321
|
+
<a href="#M000021" class="method-signature">
|
322
|
+
<span class="method-name">dup</span><span class="method-args">()</span>
|
323
|
+
</a>
|
324
|
+
</div>
|
325
|
+
|
326
|
+
<div class="method-description">
|
327
|
+
<p>
|
328
|
+
Make a deep copy of the element
|
329
|
+
</p>
|
330
|
+
<p><a class="source-toggle" href="#"
|
331
|
+
onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
|
332
|
+
<div class="method-source-code" id="M000021-source">
|
333
|
+
<pre>
|
334
|
+
<span class="ruby-comment cmt"># File lib/X12/Base.rb, line 95</span>
|
335
|
+
95: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dup</span>
|
336
|
+
96: <span class="ruby-identifier">n</span> = <span class="ruby-identifier">clone</span>
|
337
|
+
97: <span class="ruby-identifier">n</span>.<span class="ruby-identifier">set_empty!</span>
|
338
|
+
98: <span class="ruby-identifier">n</span>.<span class="ruby-identifier">nodes</span> = <span class="ruby-identifier">n</span>.<span class="ruby-identifier">nodes</span>.<span class="ruby-identifier">dup</span>
|
339
|
+
99: <span class="ruby-identifier">n</span>.<span class="ruby-identifier">nodes</span>.<span class="ruby-identifier">each_index</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
|
340
|
+
100: <span class="ruby-identifier">n</span>.<span class="ruby-identifier">nodes</span>[<span class="ruby-identifier">i</span>] = <span class="ruby-identifier">n</span>.<span class="ruby-identifier">nodes</span>[<span class="ruby-identifier">i</span>].<span class="ruby-identifier">dup</span>
|
341
|
+
101: <span class="ruby-identifier">n</span>.<span class="ruby-identifier">nodes</span>[<span class="ruby-identifier">i</span>].<span class="ruby-identifier">set_empty!</span>
|
342
|
+
102: }
|
343
|
+
103: <span class="ruby-comment cmt">#puts "Duped #{self.class} #{self.name} #{self.object_id} #{super.object_id} -> #{n.name} #{n.super.object_id} #{n.object_id} "</span>
|
344
|
+
104: <span class="ruby-identifier">n</span>
|
345
|
+
105: <span class="ruby-keyword kw">end</span>
|
346
|
+
</pre>
|
347
|
+
</div>
|
348
|
+
</div>
|
349
|
+
</div>
|
350
|
+
|
351
|
+
<div id="method-M000022" class="method-detail">
|
352
|
+
<a name="M000022"></a>
|
353
|
+
|
354
|
+
<div class="method-heading">
|
355
|
+
<a href="#M000022" class="method-signature">
|
356
|
+
<span class="method-name">find</span><span class="method-args">(e)</span>
|
357
|
+
</a>
|
358
|
+
</div>
|
359
|
+
|
360
|
+
<div class="method-description">
|
361
|
+
<p>
|
362
|
+
Recursively <a href="Base.html#M000022">find</a> a sub-element, which also
|
363
|
+
has to be of type <a href="Base.html">Base</a>.
|
364
|
+
</p>
|
365
|
+
<p><a class="source-toggle" href="#"
|
366
|
+
onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
|
367
|
+
<div class="method-source-code" id="M000022-source">
|
368
|
+
<pre>
|
369
|
+
<span class="ruby-comment cmt"># File lib/X12/Base.rb, line 108</span>
|
370
|
+
108: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">find</span>(<span class="ruby-identifier">e</span>)
|
371
|
+
109: <span class="ruby-comment cmt">#puts "Finding [#{e}] in #{self.class} #{name}"</span>
|
372
|
+
110: <span class="ruby-keyword kw">case</span> <span class="ruby-keyword kw">self</span>
|
373
|
+
111: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">X12</span><span class="ruby-operator">::</span><span class="ruby-constant">Loop</span>
|
374
|
+
112: <span class="ruby-identifier">nodes</span>.<span class="ruby-identifier">each</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
|
375
|
+
113: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">i</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">e</span><span class="ruby-operator">==</span><span class="ruby-identifier">i</span>.<span class="ruby-identifier">name</span>
|
376
|
+
114: <span class="ruby-identifier">res</span> = <span class="ruby-identifier">i</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">e</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">i</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">X12</span><span class="ruby-operator">::</span><span class="ruby-constant">Loop</span>)
|
377
|
+
115: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">res</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">res</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword kw">or</span> <span class="ruby-constant">EMPTY</span><span class="ruby-operator">==</span><span class="ruby-identifier">res</span> <span class="ruby-comment cmt"># otherwise keep looping</span>
|
378
|
+
116: }
|
379
|
+
117: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">X12</span><span class="ruby-operator">::</span><span class="ruby-constant">Segment</span>
|
380
|
+
118: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">find_field</span>(<span class="ruby-identifier">e</span>).<span class="ruby-identifier">to_s</span>
|
381
|
+
119: <span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt"># case</span>
|
382
|
+
120: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">EMPTY</span>
|
383
|
+
121: <span class="ruby-keyword kw">end</span>
|
384
|
+
</pre>
|
385
|
+
</div>
|
386
|
+
</div>
|
387
|
+
</div>
|
388
|
+
|
389
|
+
<div id="method-M000028" class="method-detail">
|
390
|
+
<a name="M000028"></a>
|
391
|
+
|
392
|
+
<div class="method-heading">
|
393
|
+
<a href="#M000028" class="method-signature">
|
394
|
+
<span class="method-name">has_content?</span><span class="method-args">()</span>
|
395
|
+
</a>
|
396
|
+
</div>
|
397
|
+
|
398
|
+
<div class="method-description">
|
399
|
+
<p>
|
400
|
+
Check if any of the fields has been set yet
|
401
|
+
</p>
|
402
|
+
<p><a class="source-toggle" href="#"
|
403
|
+
onclick="toggleCode('M000028-source');return false;">[Source]</a></p>
|
404
|
+
<div class="method-source-code" id="M000028-source">
|
405
|
+
<pre>
|
406
|
+
<span class="ruby-comment cmt"># File lib/X12/Base.rb, line 175</span>
|
407
|
+
175: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">has_content?</span>
|
408
|
+
176: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">nodes</span>.<span class="ruby-identifier">find</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">i</span>.<span class="ruby-identifier">has_content?</span>}
|
409
|
+
177: <span class="ruby-keyword kw">end</span>
|
410
|
+
</pre>
|
411
|
+
</div>
|
412
|
+
</div>
|
413
|
+
</div>
|
414
|
+
|
415
|
+
<div id="method-M000017" class="method-detail">
|
416
|
+
<a name="M000017"></a>
|
417
|
+
|
418
|
+
<div class="method-heading">
|
419
|
+
<a href="#M000017" class="method-signature">
|
420
|
+
<span class="method-name">inspect</span><span class="method-args">()</span>
|
421
|
+
</a>
|
422
|
+
</div>
|
423
|
+
|
424
|
+
<div class="method-description">
|
425
|
+
<p>
|
426
|
+
Formats a printable string containing the base element‘s content
|
427
|
+
</p>
|
428
|
+
<p><a class="source-toggle" href="#"
|
429
|
+
onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
|
430
|
+
<div class="method-source-code" id="M000017-source">
|
431
|
+
<pre>
|
432
|
+
<span class="ruby-comment cmt"># File lib/X12/Base.rb, line 53</span>
|
433
|
+
53: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">inspect</span>
|
434
|
+
54: <span class="ruby-node">"#{self.class.to_s.sub(/^.*::/, '')} (#{name}) #{repeats} #{super.inspect[1..-2]} =<#{parsed_str}, #{next_repeat.inspect}> "</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\\*\"/</span>, <span class="ruby-value str">'"'</span>)
|
435
|
+
55: <span class="ruby-keyword kw">end</span>
|
436
|
+
</pre>
|
437
|
+
</div>
|
438
|
+
</div>
|
439
|
+
</div>
|
440
|
+
|
441
|
+
<div id="method-M000025" class="method-detail">
|
442
|
+
<a name="M000025"></a>
|
443
|
+
|
444
|
+
<div class="method-heading">
|
445
|
+
<a href="#M000025" class="method-signature">
|
446
|
+
<span class="method-name">method_missing</span><span class="method-args">(meth, *args) {|res if block_given?| ...}</span>
|
447
|
+
</a>
|
448
|
+
</div>
|
449
|
+
|
450
|
+
<div class="method-description">
|
451
|
+
<p>
|
452
|
+
The main method implementing Ruby-like access methods for nested elements
|
453
|
+
</p>
|
454
|
+
<p><a class="source-toggle" href="#"
|
455
|
+
onclick="toggleCode('M000025-source');return false;">[Source]</a></p>
|
456
|
+
<div class="method-source-code" id="M000025-source">
|
457
|
+
<pre>
|
458
|
+
<span class="ruby-comment cmt"># File lib/X12/Base.rb, line 140</span>
|
459
|
+
140: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">meth</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
460
|
+
141: <span class="ruby-identifier">str</span> = <span class="ruby-identifier">meth</span>.<span class="ruby-identifier">id2name</span>
|
461
|
+
142: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">str</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/=$/</span>
|
462
|
+
143: <span class="ruby-comment cmt"># Assignment</span>
|
463
|
+
144: <span class="ruby-identifier">str</span>.<span class="ruby-identifier">chop!</span>
|
464
|
+
145: <span class="ruby-comment cmt">#puts str</span>
|
465
|
+
146: <span class="ruby-keyword kw">case</span> <span class="ruby-keyword kw">self</span>
|
466
|
+
147: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">X12</span><span class="ruby-operator">::</span><span class="ruby-constant">Segment</span>
|
467
|
+
148: <span class="ruby-identifier">res</span> = <span class="ruby-identifier">find_field</span>(<span class="ruby-identifier">str</span>)
|
468
|
+
149: <span class="ruby-identifier">throw</span> <span class="ruby-constant">Exception</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">"No field '#{str}' in segment '#{self.name}'"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-constant">EMPTY</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">res</span>
|
469
|
+
150: <span class="ruby-identifier">res</span>.<span class="ruby-identifier">content</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">to_s</span>
|
470
|
+
151: <span class="ruby-comment cmt">#puts res.inspect</span>
|
471
|
+
152: <span class="ruby-keyword kw">else</span>
|
472
|
+
153: <span class="ruby-identifier">throw</span> <span class="ruby-constant">Exception</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">"Illegal assignment to #{meth} of #{self.class}"</span>)
|
473
|
+
154: <span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt"># case</span>
|
474
|
+
155: <span class="ruby-keyword kw">else</span>
|
475
|
+
156: <span class="ruby-comment cmt"># Retrieval</span>
|
476
|
+
157: <span class="ruby-identifier">res</span> = <span class="ruby-identifier">find</span>(<span class="ruby-identifier">str</span>)
|
477
|
+
158: <span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">res</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
478
|
+
159: <span class="ruby-identifier">res</span>
|
479
|
+
160: <span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt"># if assignment</span>
|
480
|
+
161: <span class="ruby-keyword kw">end</span>
|
481
|
+
</pre>
|
482
|
+
</div>
|
483
|
+
</div>
|
484
|
+
</div>
|
485
|
+
|
486
|
+
<div id="method-M000029" class="method-detail">
|
487
|
+
<a name="M000029"></a>
|
488
|
+
|
489
|
+
<div class="method-heading">
|
490
|
+
<a href="#M000029" class="method-signature">
|
491
|
+
<span class="method-name">repeat</span><span class="method-args">() {|res if block_given?| ...}</span>
|
492
|
+
</a>
|
493
|
+
</div>
|
494
|
+
|
495
|
+
<div class="method-description">
|
496
|
+
<p>
|
497
|
+
Adds a <a href="Base.html#M000029">repeat</a> to a segment or loop. Returns
|
498
|
+
a <a href="Base.html#M000016">new</a> segment/loop or self if empty.
|
499
|
+
</p>
|
500
|
+
<p><a class="source-toggle" href="#"
|
501
|
+
onclick="toggleCode('M000029-source');return false;">[Source]</a></p>
|
502
|
+
<div class="method-source-code" id="M000029-source">
|
503
|
+
<pre>
|
504
|
+
<span class="ruby-comment cmt"># File lib/X12/Base.rb, line 180</span>
|
505
|
+
180: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">repeat</span>
|
506
|
+
181: <span class="ruby-identifier">res</span> = <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">has_content?</span> <span class="ruby-comment cmt"># Do not repeat an empty segment</span>
|
507
|
+
182: <span class="ruby-identifier">last_repeat</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_a</span>[<span class="ruby-value">-1</span>]
|
508
|
+
183: <span class="ruby-identifier">last_repeat</span>.<span class="ruby-identifier">next_repeat</span> = <span class="ruby-identifier">last_repeat</span>.<span class="ruby-identifier">dup</span>
|
509
|
+
184: <span class="ruby-keyword kw">else</span>
|
510
|
+
185: <span class="ruby-keyword kw">self</span>
|
511
|
+
186: <span class="ruby-keyword kw">end</span>
|
512
|
+
187: <span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">res</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
513
|
+
188: <span class="ruby-identifier">res</span>
|
514
|
+
189: <span class="ruby-keyword kw">end</span>
|
515
|
+
</pre>
|
516
|
+
</div>
|
517
|
+
</div>
|
518
|
+
</div>
|
519
|
+
|
520
|
+
<div id="method-M000020" class="method-detail">
|
521
|
+
<a name="M000020"></a>
|
522
|
+
|
523
|
+
<div class="method-heading">
|
524
|
+
<a href="#M000020" class="method-signature">
|
525
|
+
<span class="method-name">set_empty!</span><span class="method-args">()</span>
|
526
|
+
</a>
|
527
|
+
</div>
|
528
|
+
|
529
|
+
<div class="method-description">
|
530
|
+
<p>
|
531
|
+
<a href="Empty.html">Empty</a> out the current element
|
532
|
+
</p>
|
533
|
+
<p><a class="source-toggle" href="#"
|
534
|
+
onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
|
535
|
+
<div class="method-source-code" id="M000020-source">
|
536
|
+
<pre>
|
537
|
+
<span class="ruby-comment cmt"># File lib/X12/Base.rb, line 88</span>
|
538
|
+
88: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_empty!</span>
|
539
|
+
89: <span class="ruby-ivar">@next_repeat</span> = <span class="ruby-keyword kw">nil</span>
|
540
|
+
90: <span class="ruby-ivar">@parsed_str</span> = <span class="ruby-keyword kw">nil</span>
|
541
|
+
91: <span class="ruby-keyword kw">self</span>
|
542
|
+
92: <span class="ruby-keyword kw">end</span>
|
543
|
+
</pre>
|
544
|
+
</div>
|
545
|
+
</div>
|
546
|
+
</div>
|
547
|
+
|
548
|
+
<div id="method-M000018" class="method-detail">
|
549
|
+
<a name="M000018"></a>
|
550
|
+
|
551
|
+
<div class="method-heading">
|
552
|
+
<a href="#M000018" class="method-signature">
|
553
|
+
<span class="method-name">show</span><span class="method-args">(ind = '')</span>
|
554
|
+
</a>
|
555
|
+
</div>
|
556
|
+
|
557
|
+
<div class="method-description">
|
558
|
+
<p>
|
559
|
+
Prints a tree-like representation of the element
|
560
|
+
</p>
|
561
|
+
<p><a class="source-toggle" href="#"
|
562
|
+
onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
|
563
|
+
<div class="method-source-code" id="M000018-source">
|
564
|
+
<pre>
|
565
|
+
<span class="ruby-comment cmt"># File lib/X12/Base.rb, line 58</span>
|
566
|
+
58: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">show</span>(<span class="ruby-identifier">ind</span> = <span class="ruby-value str">''</span>)
|
567
|
+
59: <span class="ruby-identifier">count</span> = <span class="ruby-value">0</span>
|
568
|
+
60: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_a</span>.<span class="ruby-identifier">each</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
|
569
|
+
61: <span class="ruby-comment cmt">#puts "#{ind}#{i.name} #{i.object_id} #{i.super.object_id} [#{count}]: #{i.parsed_str} #{i.super.class}"</span>
|
570
|
+
62: <span class="ruby-identifier">puts</span> <span class="ruby-node">"#{ind}#{i.name} [#{count}]: #{i.to_s.sub(/^(.{30})(.*?)(.{30})$/, '\1...\3')}"</span>
|
571
|
+
63: <span class="ruby-identifier">i</span>.<span class="ruby-identifier">nodes</span>.<span class="ruby-identifier">each</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">j</span><span class="ruby-operator">|</span>
|
572
|
+
64: <span class="ruby-keyword kw">case</span>
|
573
|
+
65: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">j</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">X12</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">j</span>.<span class="ruby-identifier">show</span>(<span class="ruby-identifier">ind</span><span class="ruby-operator">+</span><span class="ruby-value str">' '</span>)
|
574
|
+
66: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">j</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">X12</span><span class="ruby-operator">::</span><span class="ruby-constant">Field</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">puts</span> <span class="ruby-node">"#{ind+' '}#{j.name} -> '#{j.to_s}'"</span>
|
575
|
+
67: <span class="ruby-keyword kw">end</span>
|
576
|
+
68: }
|
577
|
+
69: <span class="ruby-identifier">count</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
578
|
+
70: }
|
579
|
+
71: <span class="ruby-keyword kw">end</span>
|
580
|
+
</pre>
|
581
|
+
</div>
|
582
|
+
</div>
|
583
|
+
</div>
|
584
|
+
|
585
|
+
<div id="method-M000027" class="method-detail">
|
586
|
+
<a name="M000027"></a>
|
587
|
+
|
588
|
+
<div class="method-heading">
|
589
|
+
<a href="#M000027" class="method-signature">
|
590
|
+
<span class="method-name">size</span><span class="method-args">()</span>
|
591
|
+
</a>
|
592
|
+
</div>
|
593
|
+
|
594
|
+
<div class="method-description">
|
595
|
+
<p>
|
596
|
+
Returns number of repeats
|
597
|
+
</p>
|
598
|
+
<p><a class="source-toggle" href="#"
|
599
|
+
onclick="toggleCode('M000027-source');return false;">[Source]</a></p>
|
600
|
+
<div class="method-source-code" id="M000027-source">
|
601
|
+
<pre>
|
602
|
+
<span class="ruby-comment cmt"># File lib/X12/Base.rb, line 170</span>
|
603
|
+
170: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">size</span>
|
604
|
+
171: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_a</span>.<span class="ruby-identifier">size</span>
|
605
|
+
172: <span class="ruby-keyword kw">end</span>
|
606
|
+
</pre>
|
607
|
+
</div>
|
608
|
+
</div>
|
609
|
+
</div>
|
610
|
+
|
611
|
+
<div id="method-M000023" class="method-detail">
|
612
|
+
<a name="M000023"></a>
|
613
|
+
|
614
|
+
<div class="method-heading">
|
615
|
+
<a href="#M000023" class="method-signature">
|
616
|
+
<span class="method-name">to_a</span><span class="method-args">()</span>
|
617
|
+
</a>
|
618
|
+
</div>
|
619
|
+
|
620
|
+
<div class="method-description">
|
621
|
+
<p>
|
622
|
+
Present self and all repeats as an array with self being 0
|
623
|
+
</p>
|
624
|
+
<p><a class="source-toggle" href="#"
|
625
|
+
onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
|
626
|
+
<div class="method-source-code" id="M000023-source">
|
627
|
+
<pre>
|
628
|
+
<span class="ruby-comment cmt"># File lib/X12/Base.rb, line 124</span>
|
629
|
+
124: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_a</span>
|
630
|
+
125: <span class="ruby-identifier">res</span> = [<span class="ruby-keyword kw">self</span>]
|
631
|
+
126: <span class="ruby-identifier">nr</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">next_repeat</span>
|
632
|
+
127: <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">nr</span> <span class="ruby-keyword kw">do</span>
|
633
|
+
128: <span class="ruby-identifier">res</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">nr</span>
|
634
|
+
129: <span class="ruby-identifier">nr</span> = <span class="ruby-identifier">nr</span>.<span class="ruby-identifier">next_repeat</span>
|
635
|
+
130: <span class="ruby-keyword kw">end</span>
|
636
|
+
131: <span class="ruby-identifier">res</span>
|
637
|
+
132: <span class="ruby-keyword kw">end</span>
|
638
|
+
</pre>
|
639
|
+
</div>
|
640
|
+
</div>
|
641
|
+
</div>
|
642
|
+
|
643
|
+
<div id="method-M000024" class="method-detail">
|
644
|
+
<a name="M000024"></a>
|
645
|
+
|
646
|
+
<div class="method-heading">
|
647
|
+
<a href="#M000024" class="method-signature">
|
648
|
+
<span class="method-name">to_s</span><span class="method-args">()</span>
|
649
|
+
</a>
|
650
|
+
</div>
|
651
|
+
|
652
|
+
<div class="method-description">
|
653
|
+
<p>
|
654
|
+
Returns a parsed string representation of the element
|
655
|
+
</p>
|
656
|
+
<p><a class="source-toggle" href="#"
|
657
|
+
onclick="toggleCode('M000024-source');return false;">[Source]</a></p>
|
658
|
+
<div class="method-source-code" id="M000024-source">
|
659
|
+
<pre>
|
660
|
+
<span class="ruby-comment cmt"># File lib/X12/Base.rb, line 135</span>
|
661
|
+
135: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
|
662
|
+
136: <span class="ruby-ivar">@parsed_str</span> <span class="ruby-operator">||</span> <span class="ruby-value str">''</span>
|
663
|
+
137: <span class="ruby-keyword kw">end</span>
|
664
|
+
</pre>
|
665
|
+
</div>
|
666
|
+
</div>
|
667
|
+
</div>
|
668
|
+
|
669
|
+
|
670
|
+
</div>
|
671
|
+
|
672
|
+
|
673
|
+
</div>
|
674
|
+
|
675
|
+
|
676
|
+
</body>
|
677
|
+
</html>
|