Class: EdifactConverter::EDI2XML11::UNBHandler
- Inherits:
-
EdifactConverter::EmptyHandler
- Object
- EdifactConverter::EmptyHandler
- EdifactConverter::EDI2XML11::UNBHandler
- Defined in:
- lib/edifact_converter/edi2xml11/properties_handler.rb
Instance Attribute Summary collapse
-
#date_str ⇒ Object
Returns the value of attribute date_str.
-
#elements ⇒ Object
Returns the value of attribute elements.
-
#time_str ⇒ Object
Returns the value of attribute time_str.
-
#values ⇒ Object
Returns the value of attribute values.
Attributes inherited from EdifactConverter::EmptyHandler
Instance Method Summary collapse
- #clear ⇒ Object
-
#initialize ⇒ UNBHandler
constructor
A new instance of UNBHandler.
- #startElement ⇒ Object
- #value(value) ⇒ Object
Methods inherited from EdifactConverter::EmptyHandler
Constructor Details
#initialize ⇒ UNBHandler
Returns a new instance of UNBHandler.
9 10 11 |
# File 'lib/edifact_converter/edi2xml11/properties_handler.rb', line 9 def initialize clear end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class EdifactConverter::EmptyHandler
Instance Attribute Details
#date_str ⇒ Object
Returns the value of attribute date_str.
7 8 9 |
# File 'lib/edifact_converter/edi2xml11/properties_handler.rb', line 7 def date_str @date_str end |
#elements ⇒ Object
Returns the value of attribute elements.
7 8 9 |
# File 'lib/edifact_converter/edi2xml11/properties_handler.rb', line 7 def elements @elements end |
#time_str ⇒ Object
Returns the value of attribute time_str.
7 8 9 |
# File 'lib/edifact_converter/edi2xml11/properties_handler.rb', line 7 def time_str @time_str end |
#values ⇒ Object
Returns the value of attribute values.
7 8 9 |
# File 'lib/edifact_converter/edi2xml11/properties_handler.rb', line 7 def values @values end |
Instance Method Details
#clear ⇒ Object
13 14 15 16 |
# File 'lib/edifact_converter/edi2xml11/properties_handler.rb', line 13 def clear self.elements = 0 self.values = 0 end |
#startElement ⇒ Object
18 19 20 21 |
# File 'lib/edifact_converter/edi2xml11/properties_handler.rb', line 18 def startElement self.elements += 1 self.values = 0 end |
#value(value) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/edifact_converter/edi2xml11/properties_handler.rb', line 23 def value(value) self.values += 1 case when elements == 2 && values == 1 locator.properties[:sender_ean] = value when elements == 3 && values == 1 locator.properties[:receiver_ean] = value when elements == 4 && values == 1 self.time_str = value when elements == 4 && values == 2 self.time_str << value locator.properties[:sent_at] = Time.strptime time_str, "%y%m%d%H%M" when elements == 5 && values == 1 locator.properties[:envelope_id] = value end end |