baldr 0.3.1 → 0.3.2

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/lib/baldr/builder.rb CHANGED
@@ -56,7 +56,7 @@ class Baldr::Builder
56
56
  protected
57
57
 
58
58
  def version
59
- @version ||= Baldr::Grammar.for_version(@standard_version_number)
59
+ @version ||= Baldr::Grammar.for_standard_version(@standard_version_number)
60
60
  end
61
61
 
62
62
  end
@@ -48,7 +48,7 @@ class Baldr::Envelope < Baldr::Segment
48
48
  end
49
49
 
50
50
  def transactions
51
- @transactions ||= func_group_loop.segments.map{ |f| f.transactions }.flatten
51
+ @transactions ||= func_group_loop.segments.map(&:transactions).flatten
52
52
  end
53
53
 
54
54
  def GS(&block)
@@ -104,18 +104,6 @@ class Baldr::Envelope < Baldr::Segment
104
104
  self.time = value.strftime('%H%M')
105
105
  end
106
106
 
107
- def custom_validate!(version)
108
- trailer = @children.last.segments.first
109
- if trailer['IEA01'].to_i != func_group_loop.segments.count
110
- raise "wrong functional groups number: #{trailer['IEA01']} in IEA01, but real number is #{func_group_loop.segments.count}"
111
- end
112
- if trailer['IEA02'] != interchange_control_number
113
- raise "interchange control numbers don't match: #{trailer['IEA02']} in IEA02 and #{interchange_control_number} in ISA13"
114
- end
115
- end
116
-
117
- protected
118
-
119
107
  def func_group_loop
120
108
  @func_group_loop ||= @children.select{ |c| c.id == 'GS' }.first
121
109
  end
@@ -31,7 +31,7 @@ class Baldr::FunctionalGroup < Baldr::Segment
31
31
  end
32
32
 
33
33
  def sub_version
34
- Baldr::Grammar.for_version(version_release_industry_code)
34
+ Baldr::Grammar.for_standard_version(version_release_industry_code)
35
35
  end
36
36
 
37
37
  def transactions
@@ -47,24 +47,6 @@ class Baldr::FunctionalGroup < Baldr::Segment
47
47
  self.time = value.strftime('%H%M')
48
48
  end
49
49
 
50
- def custom_validate!(version)
51
- transaction_loop.segments.each do |transaction|
52
- if version.for_transaction_set(transaction.transaction_set_code)::FUNCTIONAL_GROUP != functional_identifier_code
53
- raise "wrong transaction #{transaction.transaction_set_code} in functional group #{functional_identifier_code}"
54
- end
55
- end
56
-
57
- trailer = @children.second.segments.first
58
- if trailer['GE01'].to_i != transaction_loop.segments.count
59
- raise "wrong transactions number: #{trailer['GE01']} in GE01, but real number is #{transaction_loop.segments.count}"
60
- end
61
- if trailer['GE02'] != group_control_number
62
- raise "group control numbers don't match: #{trailer['GE02']} in GE02 and #{group_control_number} in GS06"
63
- end
64
- end
65
-
66
- protected
67
-
68
50
  def transaction_loop
69
51
  @children.first
70
52
  end
@@ -1,5 +1,52 @@
1
1
  module Baldr::Grammar::Envelope
2
2
 
3
+ extend self
4
+
5
+ def structure
6
+ STRUCTURE
7
+ end
8
+
9
+ def record_defs
10
+ RECORD_DEFS
11
+ end
12
+
13
+ def validate_st!(segment)
14
+ trailer = segment.children.last.segments.first
15
+ total_number = segment.number_of_segments
16
+ if trailer['SE01'].to_i != total_number
17
+ raise Baldr::Error, "wrong segments number: #{trailer['SE01']} in SE01, but real number is #{total_number}"
18
+ end
19
+ if trailer['SE02'] != segment.transaction_control_number
20
+ raise Baldr::Error, "transaction set control numbers don't match: #{trailer['SE02']} in SE02 and #{segment.transaction_control_number} in ST02"
21
+ end
22
+ end
23
+
24
+ def validate_gs!(segment)
25
+ #segment.transaction_loop.segments.each do |transaction|
26
+ # if version.for_transaction_set(transaction.transaction_set_code)::FUNCTIONAL_GROUP != segment.functional_identifier_code
27
+ # raise Baldr::Error, "wrong transaction #{transaction.transaction_set_code} in functional group #{segment.functional_identifier_code}"
28
+ # end
29
+ #end
30
+
31
+ trailer = segment.children.second.segments.first
32
+ if trailer['GE01'].to_i != segment.transaction_loop.segments.count
33
+ raise Baldr::Error, "wrong transactions number: #{trailer['GE01']} in GE01, but real number is #{segment.transaction_loop.segments.count}"
34
+ end
35
+ if trailer['GE02'] != segment.group_control_number
36
+ raise Baldr::Error, "group control numbers don't match: #{trailer['GE02']} in GE02 and #{segment.group_control_number} in GS06"
37
+ end
38
+ end
39
+
40
+ def validate_isa!(segment)
41
+ trailer = segment.children.last.segments.first
42
+ if trailer['IEA01'].to_i != segment.func_group_loop.segments.count
43
+ raise "wrong functional groups number: #{trailer['IEA01']} in IEA01, but real number is #{segment.func_group_loop.segments.count}"
44
+ end
45
+ if trailer['IEA02'] != segment.interchange_control_number
46
+ raise "interchange control numbers don't match: #{trailer['IEA02']} in IEA02 and #{segment.interchange_control_number} in ISA13"
47
+ end
48
+ end
49
+
3
50
  STRUCTURE = {
4
51
  id: 'ISA', min: 0, max: 99999, class: :envelope, level: [
5
52
  {id: 'TA1', min: 0, max: 99999},
@@ -40,19 +87,14 @@ module Baldr::Grammar::Envelope
40
87
  {id: 'GS07', required: true, max: 2, type: :id},
41
88
  {id: 'GS08', required: true, max: 12, type: :string},
42
89
  ],
43
- 'ST' => [
44
- {id: 'ST01', required: true, max: 3, type: :id},
45
- {id: 'ST02', required: true, min: 4, max: 9, type: :string},
46
- {id: 'ST03', required: false, max: 35, type: :string},
47
- ],
48
- 'SE' => [
49
- {id: 'SE01', required: true, max: 10, type: :number, decimals: 0},
50
- {id: 'SE02', required: true, min: 4, max: 9, type: :string},
51
- ],
52
90
  'GE' => [
53
91
  {id: 'GE01', required: true, max: 6, type: :number, decimals: 0},
54
92
  {id: 'GE02', required: true, max: 9, type: :number, decimals: 0},
55
93
  ],
94
+ 'ST' => [
95
+ {id: 'ST01', required: true, max: 3, type: :id},
96
+ {id: 'ST02', required: true, min: 4, max: 9, type: :string},
97
+ ],
56
98
  'IEA' => [
57
99
  {id: 'IEA01', required: true, max: 5, type: :number, decimals: 0},
58
100
  {id: 'IEA02', required: true, max: 9, type: :number, decimals: 0},
@@ -0,0 +1,35 @@
1
+ module Baldr::Grammar::Transaction
2
+
3
+ extend self
4
+
5
+ def structure
6
+ STRUCTURE
7
+ end
8
+
9
+ def record_defs
10
+ RECORD_DEFS
11
+ end
12
+
13
+ def validate_st!(segment)
14
+ trailer = segment.children.last.segments.first
15
+ total_number = segment.number_of_segments
16
+ if trailer['SE01'].to_i != total_number
17
+ raise Baldr::Error, "wrong segments number: #{trailer['SE01']} in SE01, but real number is #{total_number}"
18
+ end
19
+ if trailer['SE02'] != segment.transaction_control_number
20
+ raise Baldr::Error, "transaction set control numbers don't match: #{trailer['SE02']} in SE02 and #{segment.transaction_control_number} in ST02"
21
+ end
22
+ end
23
+
24
+ STRUCTURE = {
25
+ id: 'ST', min: 0, class: :transaction, max: 99999
26
+ }.freeze
27
+
28
+ RECORD_DEFS = {
29
+ 'ST' => [
30
+ {id: 'ST01', required: true, max: 3, type: :id},
31
+ {id: 'ST02', required: true, min: 4, max: 9, type: :string},
32
+ ],
33
+ }
34
+
35
+ end
@@ -1,5 +1,15 @@
1
1
  module Baldr::Grammar::Version4010::Set204
2
2
 
3
+ extend self
4
+
5
+ def structure
6
+ STRUCTURE
7
+ end
8
+
9
+ def record_defs
10
+ Baldr::Grammar::Version4010::RECORD_DEFS
11
+ end
12
+
3
13
  FUNCTIONAL_GROUP = 'SM'
4
14
 
5
15
  STRUCTURE = {
@@ -1,5 +1,15 @@
1
1
  module Baldr::Grammar::Version4010::Set210
2
2
 
3
+ extend self
4
+
5
+ def structure
6
+ STRUCTURE
7
+ end
8
+
9
+ def record_defs
10
+ Baldr::Grammar::Version4010::RECORD_DEFS
11
+ end
12
+
3
13
  FUNCTIONAL_GROUP = 'IM'
4
14
 
5
15
  STRUCTURE = {
@@ -1,5 +1,15 @@
1
1
  module Baldr::Grammar::Version4010::Set214
2
2
 
3
+ extend self
4
+
5
+ def structure
6
+ STRUCTURE
7
+ end
8
+
9
+ def record_defs
10
+ Baldr::Grammar::Version4010::RECORD_DEFS
11
+ end
12
+
3
13
  FUNCTIONAL_GROUP = 'QM'
4
14
 
5
15
  STRUCTURE = {
@@ -1,5 +1,15 @@
1
1
  module Baldr::Grammar::Version4010::Set810
2
2
 
3
+ extend self
4
+
5
+ def structure
6
+ STRUCTURE
7
+ end
8
+
9
+ def record_defs
10
+ Baldr::Grammar::Version4010::RECORD_DEFS
11
+ end
12
+
3
13
  FUNCTIONAL_GROUP = 'IN'
4
14
 
5
15
  STRUCTURE = {
@@ -1,5 +1,15 @@
1
1
  module Baldr::Grammar::Version4010::Set850
2
2
 
3
+ extend self
4
+
5
+ def structure
6
+ STRUCTURE
7
+ end
8
+
9
+ def record_defs
10
+ Baldr::Grammar::Version4010::RECORD_DEFS
11
+ end
12
+
3
13
  FUNCTIONAL_GROUP = 'PO'
4
14
 
5
15
  STRUCTURE = {
@@ -1,5 +1,15 @@
1
1
  module Baldr::Grammar::Version4010::Set855
2
2
 
3
+ extend self
4
+
5
+ def structure
6
+ STRUCTURE
7
+ end
8
+
9
+ def record_defs
10
+ Baldr::Grammar::Version4010::RECORD_DEFS
11
+ end
12
+
3
13
  FUNCTIONAL_GROUP = 'PR'
4
14
 
5
15
  STRUCTURE = {
@@ -1,5 +1,15 @@
1
1
  module Baldr::Grammar::Version4010::Set856
2
2
 
3
+ extend self
4
+
5
+ def structure
6
+ STRUCTURE
7
+ end
8
+
9
+ def record_defs
10
+ Baldr::Grammar::Version4010::RECORD_DEFS
11
+ end
12
+
3
13
  FUNCTIONAL_GROUP = 'SH'
4
14
 
5
15
  STRUCTURE = {
@@ -1,5 +1,15 @@
1
1
  module Baldr::Grammar::Version4010::Set990
2
2
 
3
+ extend self
4
+
5
+ def structure
6
+ STRUCTURE
7
+ end
8
+
9
+ def record_defs
10
+ Baldr::Grammar::Version4010::RECORD_DEFS
11
+ end
12
+
3
13
  FUNCTIONAL_GROUP = 'GF'
4
14
 
5
15
  STRUCTURE = {
@@ -1,5 +1,15 @@
1
1
  module Baldr::Grammar::Version4010::Set997
2
2
 
3
+ extend self
4
+
5
+ def structure
6
+ STRUCTURE
7
+ end
8
+
9
+ def record_defs
10
+ Baldr::Grammar::Version4010::RECORD_DEFS
11
+ end
12
+
3
13
  FUNCTIONAL_GROUP = 'FA'
4
14
 
5
15
  STRUCTURE = {
data/lib/baldr/grammar.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Baldr::Grammar
2
2
 
3
- def self.for_version(version)
3
+ def self.for_standard_version(version)
4
4
  case version.length
5
5
  when 4
6
6
  self.const_get("Version#{version}")
data/lib/baldr/parser.rb CHANGED
@@ -1,33 +1,70 @@
1
1
  class Baldr::Parser
2
2
 
3
- attr_reader :error, :envelopes, :separators, :input
3
+ attr_reader :error, :separators, :input, :root_type
4
4
 
5
- def initialize(input)
6
- parse(input)
5
+ def initialize(input, params = {})
6
+ @params = params
7
+ @input = input
8
+ parse
7
9
  end
8
10
 
9
11
  def successful?
10
12
  @error.nil?
11
13
  end
12
14
 
15
+ def envelopes
16
+ if @root_type == :envelope
17
+ @roots
18
+ else
19
+ raise Baldr::Error, "interchange doesn't have envelopes"
20
+ end
21
+ end
22
+
23
+ def transactions
24
+ if @root_type == :transaction
25
+ @roots
26
+ else
27
+ @roots.map(&:transactions).flatten
28
+ end
29
+ end
30
+
13
31
  protected
14
32
 
15
- def parse(input)
16
- @input = input
17
- @separators = detect_separators(input)
18
- @envelopes = build_tree(split_segments(input, separators))
19
- @envelopes.each { |e| Baldr::Validator.validate! e }
33
+ def parse
34
+ detect_first_segment
35
+ if @root_type == :transaction
36
+ raise Baldr::Error, "separators must be manually defined for parsing transactions" unless @params[:separators]
37
+ @separators = @params[:separators]
38
+ grammar = @params[:grammar] || Baldr::Grammar::Transaction
39
+ raise Baldr::Error, "grammar version must be manually defined for parsing transactions" unless @params[:version]
40
+ version = @params[:version]
41
+ else
42
+ detect_separators
43
+ grammar = @params[:grammar] || Baldr::Grammar::Envelope
44
+ version = nil
45
+ end
46
+ @roots = build_tree(split_segments, grammar, version)
47
+ @roots.each { |e| Baldr::Validator.validate!(e, grammar, version) }
48
+
20
49
  self
21
50
  rescue Baldr::Error => e
22
51
  @error = e.message
23
52
  end
24
53
 
25
- def detect_separators(input)
26
- io = StringIO.new(input)
54
+ def detect_first_segment
55
+ if @input[0..2] == 'ISA'
56
+ @root_type = :envelope
57
+ elsif @input[0..1] == 'ST'
58
+ @root_type = :transaction
59
+ else
60
+ raise Baldr::Error, "doesn't begin with ISA or ST..."
61
+ end
62
+ end
27
63
 
28
- isa = io.gets(3)
29
- raise Baldr::Error, "doesn't begin with ISA..." unless isa == 'ISA'
64
+ def detect_separators
65
+ io = StringIO.new(input)
30
66
 
67
+ io.seek(3, IO::SEEK_SET)
31
68
  element = io.getbyte
32
69
 
33
70
  15.times { io.bytes { |b| break if b == element } }
@@ -39,14 +76,14 @@ class Baldr::Parser
39
76
  segment << b
40
77
  end
41
78
 
42
- {
79
+ @separators = {
43
80
  element: element.chr,
44
81
  segment: segment,
45
82
  component: component.chr
46
83
  }
47
84
  end
48
85
 
49
- def split_segments(input, separators)
86
+ def split_segments
50
87
  segments = []
51
88
  buffer = []
52
89
  skip = 0
@@ -56,9 +93,9 @@ class Baldr::Parser
56
93
  if skip > 0
57
94
  skip -= 1
58
95
  else
59
- if b == separators[:segment].first
60
- segments << buffer.pack('c*').split(separators[:element])
61
- skip = separators[:segment].length - 1
96
+ if b == @separators[:segment].first
97
+ segments << buffer.pack('c*').split(@separators[:element])
98
+ skip = @separators[:segment].length - 1
62
99
  buffer = []
63
100
  else
64
101
  buffer << b
@@ -71,28 +108,35 @@ class Baldr::Parser
71
108
  segments
72
109
  end
73
110
 
74
- def build_tree(source)
75
- grammar = Baldr::Grammar::Envelope::STRUCTURE
76
- loop = build_segment(source.to_enum, grammar, nil)
111
+ def build_tree(source, grammar, version = nil)
112
+ loop = build_segment(source.to_enum, grammar, grammar.structure, version)
77
113
  loop.segments
78
114
  end
79
115
 
80
- def build_segment(enumerator, grammar, version)
116
+ def build_segment(enumerator, grammar, structure, version)
81
117
  current = enumerator.peek
82
118
 
83
- while grammar[:id] == current[0]
119
+ while structure[:id] == current[0]
84
120
  loop ||= Baldr::Loop.new(current[0])
85
- segment = Baldr.const_get((grammar[:class] || :segment).to_s.camelize).new(current[0])
121
+ segment = Baldr.const_get((structure[:class] || :segment).to_s.camelize).new(current[0])
86
122
  segment.elements = current[1..-1]
87
123
  loop.add segment
88
124
 
89
125
  enumerator.next
90
126
 
91
127
  version ||= segment.sub_version
92
- sub_grammar = segment.sub_grammar(version) || grammar
93
- sub_grammar.fetch(:level, []).each do |g|
94
- child = build_segment(enumerator, g, version)
95
- segment.children << child if child
128
+ sub_grammar = segment.sub_grammar(version)
129
+
130
+ if sub_grammar
131
+ sub_grammar.structure.fetch(:level, []).each do |s|
132
+ child = build_segment(enumerator, sub_grammar, s, version)
133
+ segment.children << child if child
134
+ end
135
+ else
136
+ structure.fetch(:level, []).each do |s|
137
+ child = build_segment(enumerator, grammar, s, version)
138
+ segment.children << child if child
139
+ end
96
140
  end
97
141
 
98
142
  current = enumerator.peek
@@ -0,0 +1,19 @@
1
+ module Baldr::Renderer::CompactJson
2
+
3
+ extend self
4
+
5
+ def draw(segments, params = {})
6
+ segments = Array.wrap(segments)
7
+ segments.map{ |s| draw_segment(s) }.to_json
8
+ end
9
+
10
+ def draw_segment(segment)
11
+ {
12
+ class: segment.class.name.demodulize.underscore,
13
+ id: segment.id,
14
+ elements: segment.elements.map(&:to_s),
15
+ children: segment.children.map{ |l| l.segments.map{ |s| draw_segment(s) } }.flatten
16
+ }
17
+ end
18
+
19
+ end
@@ -1,9 +1,10 @@
1
- module Baldr::Renderer::Json
1
+ module Baldr::Renderer::EdiLikeJson
2
2
 
3
3
  extend self
4
4
 
5
- def draw(segment, params = {})
6
- draw_segment(segment).to_json
5
+ def draw(segments, params = {})
6
+ segments = Array.wrap(segments)
7
+ segments.map{ |s| draw_segment(s) }.to_json
7
8
  end
8
9
 
9
10
  def draw_segment(segment)
@@ -8,10 +8,11 @@ module Baldr::Renderer::X12
8
8
  component: '>',
9
9
  }.freeze
10
10
 
11
- def draw(segment, params = {})
11
+ def draw(segments, params = {})
12
+ segments = Array.wrap(segments)
12
13
  separators = params[:separators] || DEFAULT_SEPARATORS
13
14
  separators[:segment] = separators[:segment].pack('c*') if separators[:segment].is_a?(Array)
14
- draw_segment(segment, separators).join
15
+ segments.map{ |s| draw_segment(s, separators).join }.join
15
16
  end
16
17
 
17
18
  def draw_segment(segment, separators)
data/lib/baldr/segment.rb CHANGED
@@ -95,10 +95,6 @@ class Baldr::Segment
95
95
 
96
96
  end
97
97
 
98
- def custom_validate!(version)
99
-
100
- end
101
-
102
98
  def number_of_segments
103
99
  1 + @children.map(&:number_of_segments).sum
104
100
  end
@@ -19,22 +19,11 @@ class Baldr::Transaction < Baldr::Segment
19
19
  end
20
20
 
21
21
  def sub_grammar(version)
22
- version.for_transaction_set(transaction_set_code)::STRUCTURE
22
+ version.for_transaction_set(transaction_set_code)
23
23
  end
24
24
 
25
25
  def functional_group(version)
26
26
  version.for_transaction_set(transaction_set_code)::FUNCTIONAL_GROUP
27
27
  end
28
28
 
29
- def custom_validate!(version)
30
- trailer = @children.last.segments.first
31
- total_number = number_of_segments
32
- if trailer['SE01'].to_i != total_number
33
- raise "wrong segments number: #{trailer['SE01']} in SE01, but real number is #{total_number}"
34
- end
35
- if trailer['SE02'] != transaction_control_number
36
- raise "transaction set control numbers don't match: #{trailer['SE02']} in SE02 and #{transaction_control_number} in ST02"
37
- end
38
- end
39
-
40
29
  end
@@ -0,0 +1,25 @@
1
+ module Baldr::Utils
2
+
3
+ extend self
4
+
5
+ def dump(segment)
6
+ Baldr::Renderer::CompactJson.draw(segment)
7
+ end
8
+
9
+ def load(string)
10
+ data = JSON.parse(string)
11
+ data.map{ |s| load_segment(s) } if data.is_a? Array
12
+ end
13
+
14
+ protected
15
+
16
+ def load_segment(hash)
17
+ segment = Baldr.const_get(hash['class'].camelize).new(hash['id'])
18
+ segment.elements = hash['elements']
19
+ hash['children'].each do |c|
20
+ segment.add(load_segment(c))
21
+ end
22
+ segment
23
+ end
24
+
25
+ end
@@ -2,15 +2,15 @@ module Baldr::Validator
2
2
 
3
3
  extend self
4
4
 
5
- def validate!(envelope)
6
- grammar = Baldr::Grammar::Envelope::STRUCTURE
7
- record_defs = Baldr::Grammar::Envelope::RECORD_DEFS
8
- validate_tree!(envelope, grammar, record_defs, nil)
5
+ def validate!(envelope, grammar = nil, version = nil)
6
+ grammar ||= Baldr::Grammar::Envelope
7
+ validate_tree!(envelope, grammar, grammar.structure, version)
9
8
  end
10
9
 
11
10
  protected
12
11
 
13
- def validate_tree!(segment, grammar, record_defs, version)
12
+ def validate_tree!(segment, grammar, structure, version)
13
+ record_defs = grammar.record_defs
14
14
  raise Baldr::Error, "unknown segment #{segment.id}" unless record_defs[segment.id]
15
15
 
16
16
  record_defs[segment.id].each.with_index do |r, i|
@@ -20,24 +20,29 @@ module Baldr::Validator
20
20
  end
21
21
 
22
22
  version ||= segment.sub_version
23
- record_defs = version::RECORD_DEFS if version
24
- sub_grammar = segment.sub_grammar(version) || grammar
23
+ sub_grammar = segment.sub_grammar(version)
24
+ structure = sub_grammar.structure if sub_grammar
25
25
 
26
26
  l = 0
27
- sub_grammar.fetch(:level, []).each do |g|
27
+ structure.fetch(:level, []).each do |s|
28
28
  loop = segment.children[l]
29
- if loop && loop.id.to_s == g[:id]
30
- check_loop_count(loop, g)
29
+ if loop && loop.id.to_s == s[:id]
30
+ check_loop_count(loop, s)
31
31
 
32
- loop.segments.each { |child| validate_tree!(child, g, record_defs, version) }
32
+ loop.segments.each { |child| validate_tree!(child, sub_grammar || grammar, s, version) }
33
33
 
34
34
  l += 1
35
+ elsif loop
36
+ raise Baldr::Error, "segment #{s[:id]} is required, but #{loop.id} was found" if s[:min] > 0
35
37
  else
36
- raise Baldr::Error, "segment #{g[:id]} is required, but #{loop.id} was found" if g[:min] > 0
38
+ raise Baldr::Error, "segment #{s[:id]} is required, but nothing was found" if s[:min] > 0
37
39
  end
38
40
  end
39
41
 
40
- segment.custom_validate!(version)
42
+ method = "validate_#{segment.id.downcase}!"
43
+ if grammar.respond_to?(method)
44
+ grammar.send(method, segment)
45
+ end
41
46
  end
42
47
 
43
48
  def check_loop_count(loop, grammar)
data/lib/baldr/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Baldr
2
- VERSION = '0.3.1'
2
+ VERSION = '0.3.2'
3
3
  end
data/lib/baldr.rb CHANGED
@@ -11,12 +11,16 @@ require 'baldr/validator'
11
11
 
12
12
  require 'baldr/error'
13
13
 
14
+ require 'baldr/utils'
15
+
14
16
  require 'baldr/renderer'
15
17
  require 'baldr/renderer/x12'
16
- require 'baldr/renderer/json'
18
+ require 'baldr/renderer/edi_like_json'
19
+ require 'baldr/renderer/compact_json'
17
20
 
18
21
  require 'baldr/grammar'
19
22
  require 'baldr/grammar/envelope'
23
+ require 'baldr/grammar/transaction'
20
24
  require 'baldr/grammar/version4010'
21
25
  require 'baldr/grammar/version4010/set204'
22
26
  require 'baldr/grammar/version4010/set210'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: baldr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-15 00:00:00.000000000 Z
12
+ date: 2013-03-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -40,6 +40,7 @@ files:
40
40
  - lib/baldr/functional_group.rb
41
41
  - lib/baldr/grammar.rb
42
42
  - lib/baldr/grammar/envelope.rb
43
+ - lib/baldr/grammar/transaction.rb
43
44
  - lib/baldr/grammar/version4010.rb
44
45
  - lib/baldr/grammar/version4010/set204.rb
45
46
  - lib/baldr/grammar/version4010/set210.rb
@@ -53,10 +54,12 @@ files:
53
54
  - lib/baldr/loop.rb
54
55
  - lib/baldr/parser.rb
55
56
  - lib/baldr/renderer.rb
56
- - lib/baldr/renderer/json.rb
57
+ - lib/baldr/renderer/compact_json.rb
58
+ - lib/baldr/renderer/edi_like_json.rb
57
59
  - lib/baldr/renderer/x12.rb
58
60
  - lib/baldr/segment.rb
59
61
  - lib/baldr/transaction.rb
62
+ - lib/baldr/utils.rb
60
63
  - lib/baldr/validator.rb
61
64
  - lib/baldr/version.rb
62
65
  homepage: https://github.com/spiridonov/baldr