Class: Spiel::NothingClass

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/spiel/maybe.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &block) ⇒ Object



21
22
23
# File 'lib/spiel/maybe.rb', line 21

def method_missing(meth, *args, &block)
  Nothing
end

Instance Method Details

#get_or_else(value) ⇒ Object



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

def get_or_else(value)
  value
end

#nil?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/spiel/maybe.rb', line 29

def nil?
  true
end

#to_sObject



33
34
35
# File 'lib/spiel/maybe.rb', line 33

def to_s
  "Nothing"
end