Class: BSV::Network::Result::NotFound
- Inherits:
-
Object
- Object
- BSV::Network::Result::NotFound
- 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
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(message: nil, metadata: {}) ⇒ NotFound
constructor
A new instance of NotFound.
- #not_found? ⇒ Boolean
Methods included from Predicates
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 = @metadata = .freeze freeze end |
Instance Attribute Details
#message ⇒ Object (readonly)
Returns the value of attribute message.
95 96 97 |
# File 'lib/bsv/network/result.rb', line 95 def @message end |
#metadata ⇒ Object (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) && == other. && == other. end |
#hash ⇒ Object
113 114 115 |
# File 'lib/bsv/network/result.rb', line 113 def hash [self.class, , ].hash end |
#not_found? ⇒ Boolean
103 104 105 |
# File 'lib/bsv/network/result.rb', line 103 def not_found? true end |