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)


26
27
28
29
30
# File 'lib/stoplight/domain/failure.rb', line 26

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)


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

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)


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

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)


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

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



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

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)


36
37
38
39
40
41
# File 'lib/stoplight/domain/failure.rb', line 36

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