Class: Typed::Some

Inherits:
Option show all
Extended by:
T::Generic, T::Sig
Defined in:
lib/typed/option.rb

Constant Summary collapse

Payload =
type_member

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(payload) ⇒ Some

Returns a new instance of Some.



59
60
61
62
# File 'lib/typed/option.rb', line 59

def initialize(payload)
  @payload = payload
  super()
end

Instance Attribute Details

#payloadObject (readonly)

Returns the value of attribute payload.



47
48
49
# File 'lib/typed/option.rb', line 47

def payload
  @payload
end

Class Method Details

.new(payload) ⇒ Object



54
55
56
# File 'lib/typed/option.rb', line 54

def self.new(payload)
  super(payload)
end

Instance Method Details

#none?Boolean

Returns:

  • (Boolean)


70
71
72
# File 'lib/typed/option.rb', line 70

def none?
  false
end

#payload_or(_value) ⇒ Object



80
81
82
# File 'lib/typed/option.rb', line 80

def payload_or(_value)
  payload
end

#some?Boolean

Returns:

  • (Boolean)


65
66
67
# File 'lib/typed/option.rb', line 65

def some?
  true
end