Class: Rumonade::NoneClass

Inherits:
Option
  • Object
show all
Includes:
Singleton
Defined in:
lib/rumonade/option.rb

Overview

Represents an Option which is empty, accessed via the constant None

Constant Summary

Constants included from Monad

Monad::DEFAULT_METHODS_TO_REPLACE_WITH_MONAD

Instance Method Summary collapse

Methods inherited from Option

#bind, empty, #get, #get_or_else, #or_nil, unit

Methods included from Monad

#can_flatten_in_monad?, #each, #flat_map_with_monad, #flatten_with_monad, included, #map_with_monad, #select, #shallow_flatten

Instance Method Details

#==(other) ⇒ Object



117
118
119
# File 'lib/rumonade/option.rb', line 117

def ==(other)
  other.equal?(self.class.instance)
end

#empty?Boolean

Returns true if None, false if Some

Returns:

  • (Boolean)

    Returns true if None, false if Some



113
114
115
# File 'lib/rumonade/option.rb', line 113

def empty?
  true
end

#to_sObject



121
122
123
# File 'lib/rumonade/option.rb', line 121

def to_s
  "None"
end