Class: Eddy::Models::FunctionalGroup

Inherits:
Object
  • Object
show all
Defined in:
lib/eddy/models/functional_group.rb

Overview

A group of Eddy::Models::TransactionSet::Base classes.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(store, control_number, *transaction_sets) ⇒ void

Parameters:



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_numberInteger

A unique control number for the Functional Group.

Returns:

  • (Integer)


13
14
15
# File 'lib/eddy/models/functional_group.rb', line 13

def control_number
  @control_number
end

#idString (readonly)

Returns:

  • (String)


7
8
9
# File 'lib/eddy/models/functional_group.rb', line 7

def id
  @id
end

#storeEddy::Data::Store

Data store for the Interchange and all encompassed components.

Returns:



10
11
12
# File 'lib/eddy/models/functional_group.rb', line 10

def store
  @store
end

#transaction_setsArray<Eddy::Models::TransactionSet>

An array of Transaction Set instances.

Returns:



16
17
18
# File 'lib/eddy/models/functional_group.rb', line 16

def transaction_sets
  @transaction_sets
end

Instance Method Details

#renderArray<#render>

Returns:



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