Module: Tins::Null

Defined in:
lib/tins/null.rb

Overview

Implementation of the null object pattern in Ruby.

Defined Under Namespace

Modules: Kernel

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missingObject



4
5
6
# File 'lib/tins/null.rb', line 4

def method_missing(*)
  self
end

Instance Method Details

#const_missingObject



8
9
10
# File 'lib/tins/null.rb', line 8

def const_missing(*)
  self
end

#inspectObject



16
17
18
# File 'lib/tins/null.rb', line 16

def inspect
  'NULL'
end

#nil?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/tins/null.rb', line 20

def nil?
  true
end

#to_sObject



12
13
14
# File 'lib/tins/null.rb', line 12

def to_s
  ''
end