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:



70
71
72
# File 'lib/philiprehberger/dot_access.rb', line 70

def method_missing(_name, *_args)
  self
end

Instance Method Details

#inspectString

Returns:

  • (String)


85
86
87
# File 'lib/philiprehberger/dot_access.rb', line 85

def inspect
  '#<NullAccess>'
end

#nil?true

Returns:

  • (true)


80
81
82
# File 'lib/philiprehberger/dot_access.rb', line 80

def nil?
  true
end

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

Returns:

  • (true)


75
76
77
# File 'lib/philiprehberger/dot_access.rb', line 75

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

#to_sString

Returns:

  • (String)


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

def to_s
  ''
end