Class: BSV::Network::Result::NotFound

Inherits:
Object
  • Object
show all
Includes:
Predicates
Defined in:
lib/bsv/network/result.rb

Overview

Represents a resource-not-found outcome. Carries an optional human-readable message and optional metadata.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Predicates

#error?, #success?

Constructor Details

#initialize(message: nil, metadata: {}) ⇒ NotFound

Returns a new instance of NotFound.



97
98
99
100
101
# File 'lib/bsv/network/result.rb', line 97

def initialize(message: nil, metadata: {})
  @message = message
  @metadata = .freeze
  freeze
end

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.



95
96
97
# File 'lib/bsv/network/result.rb', line 95

def message
  @message
end

#metadataObject (readonly)

Returns the value of attribute metadata.



95
96
97
# File 'lib/bsv/network/result.rb', line 95

def 
  @metadata
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



107
108
109
# File 'lib/bsv/network/result.rb', line 107

def ==(other)
  other.is_a?(NotFound) && message == other.message &&  == other.
end

#hashObject



113
114
115
# File 'lib/bsv/network/result.rb', line 113

def hash
  [self.class, message, ].hash
end

#not_found?Boolean

Returns:

  • (Boolean)


103
104
105
# File 'lib/bsv/network/result.rb', line 103

def not_found?
  true
end