Class: Linguadata::Option::Some

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

Instance Method Summary collapse

Instance Method Details

#and_then(&block) ⇒ Object



21
# File 'lib/linguadata.rb', line 21

def and_then(&block) = block.call(value)

#filter(&block) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/linguadata.rb', line 23

def filter(&block)
  if block.call(value)
    self
  else
    None[]
  end
end

#map(&block) ⇒ Object



11
# File 'lib/linguadata.rb', line 11

def map(&block) = Some[block.call(value)]

#none?Boolean

Returns:

  • (Boolean)


15
# File 'lib/linguadata.rb', line 15

def none? = false

#some?Boolean

Returns:

  • (Boolean)


13
# File 'lib/linguadata.rb', line 13

def some? = true

#unwrapObject



9
# File 'lib/linguadata.rb', line 9

def unwrap = value

#unwrap_or(_other) ⇒ Object



19
# File 'lib/linguadata.rb', line 19

def unwrap_or(_other) = value

#unwrap_or_else(&_block) ⇒ Object



17
# File 'lib/linguadata.rb', line 17

def unwrap_or_else(&_block) = value