Class: Stoplight::Domain::Failure Private

Inherits:
Object
  • Object
show all
Defined in:
lib/stoplight/domain/failure.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.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error_class, error_message, time) ⇒ Failure

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 Failure.

Parameters:

  • error_class (String)
  • error_message (String)
  • time (Time)


29
30
31
32
33
# File 'lib/stoplight/domain/failure.rb', line 29

def initialize(error_class, error_message, time)
  @error_class = error_class
  @error_message = error_message
  @time = time
end

Instance Attribute Details

#error_classString (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.

Returns:

  • (String)


12
13
14
# File 'lib/stoplight/domain/failure.rb', line 12

def error_class
  @error_class
end

#error_messageString (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.

Returns:

  • (String)


15
16
17
# File 'lib/stoplight/domain/failure.rb', line 15

def error_message
  @error_message
end

#timeTime (readonly) Also known as: occurred_at

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:

  • (Time)


18
19
20
# File 'lib/stoplight/domain/failure.rb', line 18

def time
  @time
end

Class Method Details

.from_error(error, time:) ⇒ Failure

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 Failure.

Parameters:

  • error (Exception)

Returns:

  • (Failure)

    a new instance of Failure



22
23
24
# File 'lib/stoplight/domain/failure.rb', line 22

def self.from_error(error, time:)
  new(error.class.name, error.message, time)
end

Instance Method Details

#==(other) ⇒ Boolean

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.

Parameters:

Returns:

  • (Boolean)


39
40
41
42
43
44
# File 'lib/stoplight/domain/failure.rb', line 39

def ==(other)
  other.is_a?(self.class) &&
    error_class == other.error_class &&
    error_message == other.error_message &&
    time == other.time
end