Class: SafeNil

Inherits:
BlankSlate show all
Includes:
Singleton
Defined in:
lib/extensions/object.rb

Instance Method Summary collapse

Methods inherited from BlankSlate

find_hidden_method, hide, reveal

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &b) ⇒ Object



23
24
25
26
# File 'lib/extensions/object.rb', line 23

def method_missing(method, *args, &b)
  return nil  unless nil.respond_to? method
  nil.send(method, *args, &b)  rescue nil
end