Class: Eancom::Edifact::CNT
- Defined in:
- lib/eancom/edifact/segments/cnt.rb
Constant Summary collapse
- TAG =
'CNT'.freeze
- TYPE =
:body.freeze
Instance Attribute Summary collapse
-
#segment_type ⇒ Object
readonly
Returns the value of attribute segment_type.
Attributes inherited from Segment
Instance Method Summary collapse
- #group_name ⇒ Object
-
#initialize(tag: nil, control_total_type_code_quantifier:, control_total_value:, measurment_unit_code: nil) ⇒ CNT
constructor
A new instance of CNT.
- #to_json_hash ⇒ Object
Methods inherited from Segment
#array, initialize_by_components, #is_body?, #is_footer?, #is_header?, #item_group_name, #starts_item?, #starts_message?, #structure, #tag?, #to_edi, #to_hash, #to_s, #validate_structure
Constructor Details
#initialize(tag: nil, control_total_type_code_quantifier:, control_total_value:, measurment_unit_code: nil) ⇒ CNT
Returns a new instance of CNT.
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/eancom/edifact/segments/cnt.rb', line 9 def initialize( tag: nil, control_total_type_code_quantifier:, control_total_value:, measurment_unit_code: nil ) @tag = tag @control_total_type_code_quantifier = control_total_type_code_quantifier @control_total_value = control_total_value @measurment_unit_code = measurment_unit_code super(tag: tag || TAG) end |
Instance Attribute Details
#segment_type ⇒ Object (readonly)
Returns the value of attribute segment_type.
7 8 9 |
# File 'lib/eancom/edifact/segments/cnt.rb', line 7 def segment_type @segment_type end |
Instance Method Details
#group_name ⇒ Object
30 31 32 |
# File 'lib/eancom/edifact/segments/cnt.rb', line 30 def group_name 'counts' end |
#to_json_hash ⇒ Object
23 24 25 26 27 28 |
# File 'lib/eancom/edifact/segments/cnt.rb', line 23 def to_json_hash hash = {} hash.merge!(control_total_type_code_quantifier: find_identifier(:control_total_type_code_quantifier)) if @control_total_type_code_quantifier hash.merge!(control_total_value: @control_total_value) if @control_total_value hash end |