Class: Puppet::Pops::Types::ExpectedActualMismatch Private

Inherits:
Mismatch show all
Defined in:
lib/puppet/pops/types/type_mismatch_describer.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Direct Known Subclasses

SizeMismatch, TypeMismatch

Instance Attribute Summary collapse

Attributes inherited from Mismatch

#path

Instance Method Summary collapse

Methods inherited from Mismatch

#canonical_path, #chop_path, #eql?, #format, #merge, #message, #path_string, #to_s

Constructor Details

#initialize(path, expected, actual) ⇒ ExpectedActualMismatch

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of ExpectedActualMismatch.



292
293
294
295
296
297
# File 'lib/puppet/pops/types/type_mismatch_describer.rb', line 292

def initialize(path, expected, actual)
  super(path)
  @expected = (expected.is_a?(Array) ? PVariantType.maybe_create(expected) : expected).normalize
  @actual = actual.normalize
  @optional = false
end

Instance Attribute Details

#actualObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



290
291
292
# File 'lib/puppet/pops/types/type_mismatch_describer.rb', line 290

def actual
  @actual
end

#expectedObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



290
291
292
# File 'lib/puppet/pops/types/type_mismatch_describer.rb', line 290

def expected
  @expected
end

Instance Method Details

#==(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



303
304
305
# File 'lib/puppet/pops/types/type_mismatch_describer.rb', line 303

def ==(o)
  super.==(o) && expected == o.expected && actual == o.actual
end

#hashObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



307
308
309
# File 'lib/puppet/pops/types/type_mismatch_describer.rb', line 307

def hash
  [canonical_path, expected, actual].hash
end

#set_optionalObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



299
300
301
# File 'lib/puppet/pops/types/type_mismatch_describer.rb', line 299

def set_optional
  @optional = true
end

#swap_expected(expected) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



311
312
313
314
315
# File 'lib/puppet/pops/types/type_mismatch_describer.rb', line 311

def swap_expected(expected)
  copy = self.clone
  copy.instance_variable_set(:@expected, expected)
  copy
end