Class: EdifactConverter::Difference

Inherits:
Object
  • Object
show all
Defined in:
lib/edifact_converter/difference.rb

Constant Summary collapse

ATTRIBUTES =
[:source, :facit, :kind, :type, :message]

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Difference

Returns a new instance of Difference.



12
13
14
15
16
17
18
19
# File 'lib/edifact_converter/difference.rb', line 12

def initialize(options)
  options.fetch(:type) { |key| options[key] = :errors }
  options.each do |name, value|
    if ATTRIBUTES.include? name
      send "#{name}=", value
    end
  end
end

Instance Method Details

#eql?(diff) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
24
25
26
27
28
# File 'lib/edifact_converter/difference.rb', line 21

def eql?(diff)
  return false unless diff.kind == kind
  if kind == :unt
    diff.source == source && diff.facit == facit
  else
    diff.source.name == source.name && diff.facit.name == facit.name 
  end
end

#to_sObject



30
31
32
# File 'lib/edifact_converter/difference.rb', line 30

def to_s
  "#{source.path} afviger fra #{facit.path} ved at #{kind} af typen #{type} og meddelelsen #{message}"
end