Class: AbideDevUtils::XCCDF::Diff::DiffChangeResult

Inherits:
Object
  • Object
show all
Defined in:
lib/abide_dev_utils/xccdf/diff/utils.rb

Overview

Holds the result of a diff on a per-item basis.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, old_value, new_value) ⇒ DiffChangeResult

Returns a new instance of DiffChangeResult.



10
11
12
13
14
# File 'lib/abide_dev_utils/xccdf/diff/utils.rb', line 10

def initialize(type, old_value, new_value)
  @type = type
  @old_value = old_value
  @new_value = new_value
end

Instance Attribute Details

#new_valueObject (readonly)

Returns the value of attribute new_value.



8
9
10
# File 'lib/abide_dev_utils/xccdf/diff/utils.rb', line 8

def new_value
  @new_value
end

#old_valueObject (readonly)

Returns the value of attribute old_value.



8
9
10
# File 'lib/abide_dev_utils/xccdf/diff/utils.rb', line 8

def old_value
  @old_value
end

#typeObject (readonly)

Returns the value of attribute type.



8
9
10
# File 'lib/abide_dev_utils/xccdf/diff/utils.rb', line 8

def type
  @type
end

Instance Method Details

#to_aObject



20
21
22
# File 'lib/abide_dev_utils/xccdf/diff/utils.rb', line 20

def to_a
  [type, old_value, new_value]
end

#to_hObject



16
17
18
# File 'lib/abide_dev_utils/xccdf/diff/utils.rb', line 16

def to_h
  { type: type, old_value: old_value, new_value: new_value }
end

#to_sObject



24
25
26
# File 'lib/abide_dev_utils/xccdf/diff/utils.rb', line 24

def to_s
  "#{type}: #{old_value} -> #{new_value}"
end