File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -151,28 +151,37 @@ Using the simple transaction set and segments defined above, here are a few ways
151151the fields.
152152
153153To create a transaction set simple choose the set you want and call new on it's Base class.
154+
154155``` ruby
155156 ts = Hippo ::TransactionSets ::Test ::Base .new
156157```
158+
157159The segments can be accessed directly from the created transaction set using the segment
158160identifier.
161+
159162``` ruby
160163 ts.TCS
161164```
165+
162166Since the TSS segment can be repeated we must call #build to generate a new
163167instance for each repeat. (You will be returned the first instance each time if you
164168do not call #build.)
169+
165170``` ruby
166171 ts.TSS .build
167172```
173+
168174The code above produces the following string output (notice how the values from
169175: defaults are prefilled, and the output is automatically sorted based on the order
170176that the segments were declared):
177+
171178``` ruby
172179 # ts.to_s => 'TSS*Blah~TCS***Preset Field 7~'
173180```
181+
174182To set field values on a given segment you can access it either by calling the field directly
175183on the segment or by passing a block to the segment.
184+
176185``` ruby
177186 # this is one way to populate the fields
178187 ts.TCS .Field1 = ' Foo'
@@ -205,11 +214,14 @@ TSS_02 instead.
205214
206215 # ts.to_s => 'TSS*Blah*Bar~TCS*Foo**Preset Field 7~TSS*Last Segment*Baz~'
207216```
217+
208218The same technique can be used to reference fields within a segment that have the same name.
219+
209220``` ruby
210221 ts.TSS .CommonName = ' Value1'
211222 ts.TSS .CommonName_02 = ' Value2'
212223
213224 # ts.to_s => 'TSS*Blah*Bar***Value1*Value2~TCS*Foo**Preset Field 7~TSS*Last Segment*Baz~'
214225```
226+
215227For more example please review the test suite.
You can’t perform that action at this time.
0 commit comments