Class: Eancom::Edifact::UNA

Inherits:
Segment
  • Object
show all
Defined in:
lib/eancom/edifact/segments/una.rb

Constant Summary collapse

TAG =
'UNA'.freeze
TYPE =
:header.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Segment

#array, #group_name, initialize_by_components, #is_body?, #is_footer?, #is_header?, #item_group_name, #starts_item?, #starts_location?, #starts_message?, #structure, #tag?, #to_edi, #to_hash, #validate_structure

Constructor Details

#initialize(tag: nil, una1: ':', una2: '+', una3: '.', una4: '?', una5: ' ', una6: '\'') ⇒ UNA

Returns a new instance of UNA.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/eancom/edifact/segments/una.rb', line 9

def initialize(tag: nil,
               una1: ':',
               una2: '+',
               una3: '.',
               una4: '?',
               una5: ' ',
               una6: '\''
              )
  @tag = tag
  @una1 = una1
  @una2 = una2
  @una3 = una3
  @una4 = una4
  @una5 = una5
  @una6 = una6

  super(tag: (tag || TAG))
end

Instance Attribute Details

#tagObject (readonly)

Returns the value of attribute tag.



7
8
9
# File 'lib/eancom/edifact/segments/una.rb', line 7

def tag
  @tag
end

#una1Object (readonly)

Returns the value of attribute una1.



7
8
9
# File 'lib/eancom/edifact/segments/una.rb', line 7

def una1
  @una1
end

#una2Object (readonly)

Returns the value of attribute una2.



7
8
9
# File 'lib/eancom/edifact/segments/una.rb', line 7

def una2
  @una2
end

#una3Object (readonly)

Returns the value of attribute una3.



7
8
9
# File 'lib/eancom/edifact/segments/una.rb', line 7

def una3
  @una3
end

#una4Object (readonly)

Returns the value of attribute una4.



7
8
9
# File 'lib/eancom/edifact/segments/una.rb', line 7

def una4
  @una4
end

#una5Object (readonly)

Returns the value of attribute una5.



7
8
9
# File 'lib/eancom/edifact/segments/una.rb', line 7

def una5
  @una5
end

#una6Object (readonly)

Returns the value of attribute una6.



7
8
9
# File 'lib/eancom/edifact/segments/una.rb', line 7

def una6
  @una6
end

Instance Method Details

#segment_typeObject



45
46
47
# File 'lib/eancom/edifact/segments/una.rb', line 45

def segment_type
  TYPE
end

#to_json_hashObject



41
42
43
# File 'lib/eancom/edifact/segments/una.rb', line 41

def to_json_hash
  {}
end

#to_sObject



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/eancom/edifact/segments/una.rb', line 29

def to_s
  stream = ""
  stream << tag
  stream << una1
  stream << una2
  stream << una3
  stream << una4
  stream << una5
  stream << una6
  stream
end