Class: Philiprehberger::DotAccess::NullAccess

Inherits:
Object
  • Object
show all
Defined in:
lib/philiprehberger/dot_access.rb

Overview

Null object that responds to any method with nil

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(_name, *_args) ⇒ NullAccess

Returns self for chaining

Returns:



89
90
91
# File 'lib/philiprehberger/dot_access.rb', line 89

def method_missing(_name, *_args)
  self
end

Instance Method Details

#inspectString

Returns:

  • (String)


104
105
106
# File 'lib/philiprehberger/dot_access.rb', line 104

def inspect
  '#<NullAccess>'
end

#nil?true

Returns:

  • (true)


99
100
101
# File 'lib/philiprehberger/dot_access.rb', line 99

def nil?
  true
end

#respond_to_missing?(_name, _include_private = false) ⇒ true

Returns:

  • (true)


94
95
96
# File 'lib/philiprehberger/dot_access.rb', line 94

def respond_to_missing?(_name, _include_private = false)
  true
end

#to_sString

Returns:

  • (String)


109
110
111
# File 'lib/philiprehberger/dot_access.rb', line 109

def to_s
  ''
end