Class: Solana::Ruby::Kit::Options::Some

Inherits:
Object
  • Object
show all
Extended by:
T::Generic, T::Sig
Defined in:
lib/solana/ruby/kit/options/option.rb

Overview

Represents the presence of a value — mirrors TypeScript’s ‘Some<T>`.

Constant Summary collapse

Elem =
type_member

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Some

Returns a new instance of Some.



24
25
26
# File 'lib/solana/ruby/kit/options/option.rb', line 24

def initialize(value)
  @value = T.let(value, Elem)
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



21
22
23
# File 'lib/solana/ruby/kit/options/option.rb', line 21

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



32
33
34
# File 'lib/solana/ruby/kit/options/option.rb', line 32

def ==(other)
  !!(other.is_a?(Some) && T.unsafe(value) == T.unsafe(other.value))
end

#inspectObject



29
# File 'lib/solana/ruby/kit/options/option.rb', line 29

def inspect = "Some(#{T.unsafe(@value).inspect})"