class RFunc::None

Public Class Methods

new() click to toggle source
Calls superclass method RFunc::AbstractOption::new
# File lib/rfunc/option.rb, line 205
def initialize
  super(nil)
end

Public Instance Methods

collect(&block) click to toggle source

Maintains signiture parity with Some.collect

@param block [Function] the block that can be used to modify the value

(should be a case statement with nil return for non operation)

@return [None] self

# File lib/rfunc/option.rb, line 287
def collect(&block)
  self
end
count(&block) click to toggle source

Counts the number of elements for which the block returns true

@param block [Function] the function that determines whether the

value should be counted

@return [Int] 0 (there is no value to operate on)

# File lib/rfunc/option.rb, line 298
def count(&block)
  0
end
empty?() click to toggle source

Indicates if the Option has a value

@return [Boolean] true

# File lib/rfunc/option.rb, line 244
def empty?
  true
end
flat_map(&block) click to toggle source

Maintains signiture parity with Some.flat_map

@param block [Function] the function which will operate on the

Option's value (should return an Option)

@return [RFunc::Option] a None

# File lib/rfunc/option.rb, line 255
def flat_map(&block)
  self
end
flatten() click to toggle source

Maintains signiture parity with Some.flatten

@return [None] self

# File lib/rfunc/option.rb, line 275
def flatten
  self
end
fold(alternate, &block) click to toggle source

Maintains signiture parity with Some.fold

@param alternate [Any] the value to return if the Option is a None @param block [Function] the function which will operate on the

current Option's value

@return [Any] the alternate

# File lib/rfunc/option.rb, line 267
def fold(alternate, &block)
  alternate
end
for_all(&block) click to toggle source

Determines if the current Option value satisfies the supplied block

@param block [Function] the function that determines whether the

value satisfies an expectation

@return [Boolean] true because the is no value to violate the supplied block

# File lib/rfunc/option.rb, line 309
def for_all(&block)
  true
end
for_each(&block) click to toggle source

Returns nil (no value to execute on)

@param block [Function] the function that takes the current Option's value

@return [Nil] nil

# File lib/rfunc/option.rb, line 319
def for_each(&block)
  nil
end
get_or_else() { || ... } click to toggle source

Allows for the return of a replacement value

@param block [Function] a block returning an alternate value

@return [Any] the result of the supplied block

# File lib/rfunc/option.rb, line 215
def get_or_else(&block)
  yield
end
map(&block) click to toggle source

Maintains signiture parity with Some.map

@param block [Function] the function which would be used to operate

on the Option's value

@return [None] a None

# File lib/rfunc/option.rb, line 236
def map(&block)
  self
end
or_else(v) click to toggle source

Returns an alternative Option for the None

@param v [Option] the option to be returned

@return [Option] the provided alternate Option

# File lib/rfunc/option.rb, line 225
def or_else(v)
  validated_option_type(v)
end