Class: Optiomist::Some

Inherits:
Object
  • Object
show all
Defined in:
lib/optiomist.rb

Overview

There is some value. Warning: nil is also treated as a correct value.

Example:

>> result = Optiomist.some('x')
>> result.some?
=> true
>> result.value
=> 'x'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Some

Returns a new instance of Some.



20
21
22
# File 'lib/optiomist.rb', line 20

def initialize(value)
  @value = value
end

Instance Attribute Details

#valueObject (readonly)

This is the value.



18
19
20
# File 'lib/optiomist.rb', line 18

def value
  @value
end

Instance Method Details

#none?Boolean

It’s false.

Returns:

  • (Boolean)


30
31
32
# File 'lib/optiomist.rb', line 30

def none?
  false
end

#some?Boolean

It’s true.

Returns:

  • (Boolean)


25
26
27
# File 'lib/optiomist.rb', line 25

def some?
  true
end