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
- #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, *transaction_sets) ⇒ void
17 18 19 20 21 22 23 24 25 |
# File 'lib/eddy/models/functional_group.rb', line 17 def initialize(store, *transaction_sets) self.store = store 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
#id ⇒ String (readonly)
7 8 9 |
# File 'lib/eddy/models/functional_group.rb', line 7 def id @id end |
#store ⇒ Eddy::Data::Store
9 10 11 |
# File 'lib/eddy/models/functional_group.rb', line 9 def store @store end |
#transaction_sets ⇒ Array<Eddy::Models::TransactionSet>
An array of Transaction Set instances.
12 13 14 |
# File 'lib/eddy/models/functional_group.rb', line 12 def transaction_sets @transaction_sets end |
Instance Method Details
#render ⇒ Array<#render>
28 29 30 31 32 33 |
# File 'lib/eddy/models/functional_group.rb', line 28 def render() f_group_ctrl_num = Eddy::Data.new_functional_group_control_number(@id) gs = Eddy::Segments::GS.new(store, f_group_ctrl_num, @id) ge = Eddy::Segments::GE.new(store, f_group_ctrl_num, self.transaction_sets.length) return [gs, self.transaction_sets, ge].flatten.map(&:render) end |