hippo 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG CHANGED
@@ -1,4 +1,6 @@
1
- 0.0.7 - TBD
1
+ 0.0.8 - TBD
2
+ * Add ability to use Regexp with TransactionSet::Base#find_by_name.
3
+ 0.0.7 - 2011/11/15
2
4
  * Add TransactionSet::Base#find_by_name to allow searching for components
3
5
  by name rather than only by identifier.
4
6
  0.0.6 - 2011/11/09
data/README.md CHANGED
@@ -222,13 +222,19 @@ TSS_02 instead.
222
222
 
223
223
  Obviously, this could get somewhat tedious when operating on a TransactionSet with many segments
224
224
  with the same identifier. As an alternative you can also access a particular segment/loop based
225
- on the name provided in the TransactionSet definition.
225
+ on the name provided in the TransactionSet definition. You can either pass the actual name or
226
+ a Regexp to search with.
226
227
 
227
228
  ```ruby
228
229
  ts.find\_by\_name('Test Simple Segment #1') do |tss|
229
230
  tss.Field2 = 'Baz'
230
231
  end
231
232
 
233
+ # which is essentially equivilent (because the search occurs in order of declaration)
234
+ ts.find\_by\_name(/Segment/) do |tss|
235
+ tss.Field2 = 'Baz'
236
+ end
237
+
232
238
  # ts.to_s => 'TSS*Blah*Baz~'
233
239
  ```
234
240
 
@@ -137,8 +137,11 @@ module Hippo::TransactionSets
137
137
  end
138
138
 
139
139
  self.class.components.select do |c|
140
- puts c.options.inspect
141
- c.options[:name] == name
140
+ if name.class == Regexp
141
+ c.options[:name] =~ name
142
+ else
143
+ c.options[:name] == name
144
+ end
142
145
  end[sequence]
143
146
  end
144
147
 
data/lib/hippo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Hippo
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -49,6 +49,15 @@ class TestTransactionSetBase < MiniTest::Unit::TestCase
49
49
  assert_equal 'TSS*Blah*Baz~', ts.to_s
50
50
  end
51
51
 
52
+ def test_accessing_segments_by_name_regexp
53
+ ts = Hippo::TransactionSets::Test::Base.new
54
+ ts.find_by_name(/Segment/) do |tss|
55
+ tss.Field2 = 'Baz'
56
+ end
57
+
58
+ assert_equal 'TSS*Blah*Baz~', ts.to_s
59
+ end
60
+
52
61
  def test_assigning_segment_values_with_block_syntax
53
62
  ts = Hippo::TransactionSets::Test::Base.new
54
63
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hippo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -14,7 +14,7 @@ date: 2011-11-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: minitest
17
- requirement: &70305083942840 !ruby/object:Gem::Requirement
17
+ requirement: &70362864845760 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :development
24
24
  prerelease: false
25
- version_requirements: *70305083942840
25
+ version_requirements: *70362864845760
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rake
28
- requirement: &70305083942340 !ruby/object:Gem::Requirement
28
+ requirement: &70362864845260 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: 0.9.2
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *70305083942340
36
+ version_requirements: *70362864845260
37
37
  description: HIPAA Transaction Set Generator/Parser
38
38
  email:
39
39
  - robertj@promedicalinc.com