Class: Eddy::Models::FunctionalGroup
- Inherits:
-
Object
- Object
- Eddy::Models::FunctionalGroup
- Defined in:
- lib/eddy/models/functional_group.rb
Overview
A group of Eddy::Models::TransactionSet::Base
classes.
Instance Attribute Summary collapse
-
#control_number ⇒ Integer
A unique control number for the Functional Group.
- #id ⇒ String readonly
-
#store ⇒ Eddy::Data::Store
Data store for the Interchange and all encompassed components.
-
#transaction_sets ⇒ Array<Eddy::Models::TransactionSet>
An array of Transaction Set instances.
Instance Method Summary collapse
Constructor Details
#initialize(store, control_number, *transaction_sets) ⇒ void
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/eddy/models/functional_group.rb', line 22 def initialize(store, control_number, *transaction_sets) self.store = store self.control_number = control_number transaction_sets.flatten! self.transaction_sets = transaction_sets || [] if self.transaction_sets.length == 0 raise ArgumentError, "At least one transaction set is required to create a functional group" end @id = self.transaction_sets.first.functional_group end |
Instance Attribute Details
#control_number ⇒ Integer
A unique control number for the Functional Group.
13 14 15 |
# File 'lib/eddy/models/functional_group.rb', line 13 def control_number @control_number end |
#id ⇒ String (readonly)
7 8 9 |
# File 'lib/eddy/models/functional_group.rb', line 7 def id @id end |
#store ⇒ Eddy::Data::Store
Data store for the Interchange and all encompassed components.
10 11 12 |
# File 'lib/eddy/models/functional_group.rb', line 10 def store @store end |
#transaction_sets ⇒ Array<Eddy::Models::TransactionSet>
An array of Transaction Set instances.
16 17 18 |
# File 'lib/eddy/models/functional_group.rb', line 16 def transaction_sets @transaction_sets end |
Instance Method Details
#render ⇒ Array<#render>
34 35 36 37 38 |
# File 'lib/eddy/models/functional_group.rb', line 34 def render() gs = Eddy::Segments::GS.new(self.store, self.control_number, @id) ge = Eddy::Segments::GE.new(self.store, self.control_number, self.transaction_sets.length) return [gs, self.transaction_sets, ge].flatten.map(&:render) end |