Class: SleepingKingStudios::Tools::Undefined
- Inherits:
- BasicObject
- Defined in:
- lib/sleeping_king_studios/tools/undefined.rb
Overview
Immutable empty object used to represent undefined method parameters.
Use an instance of Undefined as a value object to distinguish between an optional method parameter that is passed a nil value from a method parameter that is not passed.
Instance Method Summary collapse
-
#inspect ⇒ String
A string containing a human-readable representation of the object.
-
#instance_of?(mod) ⇒ true, false
True if the object is an instance of the given class.
-
#is_a?(mod) ⇒ true, false
(also: #kind_of?)
True if the given class is an ancestor of the object.
Instance Method Details
#inspect ⇒ String
Returns a string containing a human-readable representation of the object.
25 26 27 |
# File 'lib/sleeping_king_studios/tools/undefined.rb', line 25 def inspect ::Object.instance_method(:inspect).bind(self).call end |
#instance_of?(mod) ⇒ true, false
Returns true if the object is an instance of the given class.
33 34 35 |
# File 'lib/sleeping_king_studios/tools/undefined.rb', line 33 def instance_of?(mod) ::Object.instance_method(:instance_of?).bind(self).call(mod) end |
#is_a?(mod) ⇒ true, false Also known as: kind_of?
Returns true if the given class is an ancestor of the object.
41 42 43 |
# File 'lib/sleeping_king_studios/tools/undefined.rb', line 41 def is_a?(mod) ::Object.instance_method(:is_a?).bind(self).call(mod) end |