Class: EdifactConverter::Message
- Inherits:
-
Object
- Object
- EdifactConverter::Message
- Defined in:
- lib/edifact_converter/message.rb
Constant Summary collapse
- ATTRIBUTES =
[:position, :text, :source]
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options) ⇒ Message
constructor
A new instance of Message.
- #to_s ⇒ Object
Constructor Details
#initialize(options) ⇒ Message
Returns a new instance of Message.
13 14 15 16 17 |
# File 'lib/edifact_converter/message.rb', line 13 def initialize() self.position = [:position] self.text = .fetch(:text, "Ukendt fejl") self.source = .fetch(:source, :edifact) end |
Class Method Details
.from_syntax_error(error) ⇒ Object
19 20 21 22 |
# File 'lib/edifact_converter/message.rb', line 19 def self.from_syntax_error(error) position = EdifactConverter::EDI2XML11::Position.new(error.line, error.column) self.new(position: position, text: error.to_s, source: :xml) end |
Instance Method Details
#to_s ⇒ Object
24 25 26 |
# File 'lib/edifact_converter/message.rb', line 24 def to_s "#{source.to_s.capitalize}: #{text} #{position}" end |