Class: EdifactConverter::EDI2XML11::PropertiesHandler

Inherits:
EdifactConverter::EmptyHandler show all
Defined in:
lib/edifact_converter/edi2xml11/properties_handler.rb

Instance Attribute Summary collapse

Attributes inherited from EdifactConverter::EmptyHandler

#locator, #next_handler

Instance Method Summary collapse

Methods inherited from EdifactConverter::EmptyHandler

#initialize

Constructor Details

This class inherits a constructor from EdifactConverter::EmptyHandler

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args, &block) ⇒ Object



76
77
78
79
80
81
# File 'lib/edifact_converter/edi2xml11/properties_handler.rb', line 76

def method_missing(sym, *args, &block)
  state.send(sym, *args, &block) if state
  if next_handler
    next_handler.send(sym, *args, &block)
  end
end

Instance Attribute Details

#stateObject

Returns the value of attribute state.



74
75
76
# File 'lib/edifact_converter/edi2xml11/properties_handler.rb', line 74

def state
  @state
end

Instance Method Details

#endSegment(name) ⇒ Object



94
95
96
97
# File 'lib/edifact_converter/edi2xml11/properties_handler.rb', line 94

def endSegment(name)
  self.state = nil
  super
end

#startSegment(name) ⇒ Object



83
84
85
86
87
88
89
90
91
92
# File 'lib/edifact_converter/edi2xml11/properties_handler.rb', line 83

def startSegment(name)
  case name
  when 'UNB'
    self.state = UNBHandler.new
  when 'UNH'
    self.state = UNHHandler.new
  end
  state.locator = locator if state 
  super
end