Class: Solana::Ruby::Kit::Addresses::Address
- Inherits:
-
Object
- Object
- Solana::Ruby::Kit::Addresses::Address
- Extended by:
- T::Sig
- Includes:
- Comparable
- Defined in:
- lib/solana/ruby/kit/addresses/address.rb
Overview
A validated, base58-encoded Solana address (32 bytes on-wire). Mirrors the TypeScript branded type:
type Address<TAddress extends string = string> = Brand<EncodedString<TAddress, 'base58'>, 'Address'>
Because Sorbet does not support nominal/branded string types, Address is a lightweight value object whose string representation is always a validated base58 string.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(value) ⇒ Address
constructor
A new instance of Address.
- #inspect ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(value) ⇒ Address
25 26 27 |
# File 'lib/solana/ruby/kit/addresses/address.rb', line 25 def initialize(value) @value = T.let(value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
22 23 24 |
# File 'lib/solana/ruby/kit/addresses/address.rb', line 22 def value @value end |
Instance Method Details
#<=>(other) ⇒ Object
36 37 38 39 40 |
# File 'lib/solana/ruby/kit/addresses/address.rb', line 36 def <=>(other) return nil unless other.is_a?(Address) @value <=> other.value end |
#==(other) ⇒ Object Also known as: eql?
43 44 45 |
# File 'lib/solana/ruby/kit/addresses/address.rb', line 43 def ==(other) !!(other.is_a?(Address) && @value == other.value) end |
#hash ⇒ Object
48 |
# File 'lib/solana/ruby/kit/addresses/address.rb', line 48 def hash = @value.hash |
#inspect ⇒ Object
33 |
# File 'lib/solana/ruby/kit/addresses/address.rb', line 33 def inspect = "#<#{self.class} \"#{@value}\">" |
#to_s ⇒ Object
30 |
# File 'lib/solana/ruby/kit/addresses/address.rb', line 30 def to_s = @value |