Class: None

Inherits:
Object show all
Defined in:
lib/deterministic/maybe.rb

Overview

The simplest NullObject there can be

Class Method Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args) ⇒ Object

def respond_to_missing



9
10
11
# File 'lib/deterministic/maybe.rb', line 9

def method_missing(*args)
  self
end

Class Method Details

.instanceObject



3
4
5
# File 'lib/deterministic/maybe.rb', line 3

def self.instance
  @instance ||= None.new
end

Instance Method Details

#none?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/deterministic/maybe.rb', line 13

def none?
  true
end

#respond_to?(m) ⇒ Boolean

Returns:

  • (Boolean)


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

def respond_to?(m)
  true
end

#some?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/deterministic/maybe.rb', line 17

def some?
  false
end