hippo 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,10 @@
1
+ 0.0.12 - 2011/12/22
2
+ * Fix a number of parsing errors.
3
+ * Ensure that we only evaluate the first segment when matching
4
+ against non-loop components.
5
+ * Fix issue causing sub-loops to be reversed on parsing.
6
+ * Fix issue preventing proper recursion when parsing a repeating
7
+ component inside TransactionSet::Base.
1
8
  0.0.11 - 2011/12/18
2
9
  * Ignore Base Control Set when parsing input files.
3
10
  * Make sure to only append a segment when we are within a transaction.
data/README.md CHANGED
@@ -22,6 +22,10 @@ More information can be found at the following sites:
22
22
  * [5010 Implementation Timeline](https://www.cms.gov/ElectronicBillingEDITrans/18_5010D0.asp)
23
23
  * [X12 Store](https://store.x12.org)
24
24
 
25
+ Sample scripts using Hippo:
26
+
27
+ * [277CA Parser](https://gist.github.com/1492492)
28
+
25
29
  Installation
26
30
  ------------
27
31
  gem install hippo
@@ -214,6 +218,7 @@ Once you have access to the segment you can set the field values by either
214
218
  calling the field name or using its relative position in the segment. If the
215
219
  field name is used more than once in a segment or if you are accessing a
216
220
  composite field you can optionally pass the index of the field to access.
221
+
217
222
  ```ruby
218
223
  ts.TCS do |tcs|
219
224
  tcs.Field1 = 'Foo' # use the field name
@@ -38,10 +38,11 @@ module Hippo::TransactionSets
38
38
  self.class.components.each_with_index do |component, component_index|
39
39
  if component.klass.ancestors.include? Hippo::Segments::Base
40
40
  # segments
41
- segments_found = []
41
+ while true do
42
+ segment = segments.first
42
43
 
43
- segments.each do |segment|
44
- next unless component.valid? segment
44
+ break unless segment
45
+ break unless component.valid?(segment)
45
46
 
46
47
  if component.repeating?
47
48
  values[component.sequence] ||= component.initialize_component(self)
@@ -50,40 +51,29 @@ module Hippo::TransactionSets
50
51
  values[component.sequence] = segment
51
52
  end
52
53
 
53
- segments_found << segment
54
+ segments.delete(segment)
54
55
  end
55
-
56
- segments_found.each {|s| segments.delete(s)}
57
56
  else
58
57
  # loops
59
58
  while true do
60
59
  found_next_segment = false
61
60
  starting_index = nil
61
+ ending_index = nil
62
62
  length = 0
63
63
 
64
- segments.each_with_index do |segment, segment_index|
65
- next unless component.valid? segment
66
-
67
- starting_index = segment_index
68
- end
64
+ starting_index = segments.find_index{|segment| component.valid? segment}
69
65
 
70
66
  # if we don't find anything break out of the loop
71
67
  break unless starting_index
72
68
 
73
- remaining_components = self.class.components.slice(component_index + 1, self.class.components.length - 1)
69
+ remaining_components = self.class.components.slice(component_index, self.class.components.length - component_index)
74
70
  remaining_components.each do |next_component|
75
- break if found_next_segment
76
- length = 0
77
-
78
- segments.each_with_index do |segment, segment_index|
79
- found_next_segment = next_component.valid? segment
80
- break if found_next_segment
71
+ break if ending_index
81
72
 
82
- length += 1
83
- end
73
+ ending_index = segments.find_index{|segment| segment != segments[starting_index] && next_component.valid?(segment)}
84
74
  end
85
75
 
86
- length = segments.length - starting_index if length == 0
76
+ length = (ending_index || segments.length) - starting_index
87
77
 
88
78
  if component.repeating?
89
79
  values[component.sequence] ||= component.initialize_component(self)
data/lib/hippo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Hippo
2
- VERSION = "0.0.11"
2
+ VERSION = "0.0.12"
3
3
  end
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.11
4
+ version: 0.0.12
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-12-18 00:00:00.000000000 Z
13
+ date: 2011-12-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: minitest
17
- requirement: &70206774000140 !ruby/object:Gem::Requirement
17
+ requirement: &70300927203040 !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: *70206774000140
25
+ version_requirements: *70300927203040
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rake
28
- requirement: &70206773999520 !ruby/object:Gem::Requirement
28
+ requirement: &70300927202060 !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: *70206773999520
36
+ version_requirements: *70300927202060
37
37
  description: HIPAA Transaction Set Generator/Parser
38
38
  email:
39
39
  - robertj@promedicalinc.com