Class: Naught::NullClassBuilder::Commands::Traceable Private
- Inherits:
-
Naught::NullClassBuilder::Command
- Object
- Naught::NullClassBuilder::Command
- Naught::NullClassBuilder::Commands::Traceable
- Defined in:
- lib/naught/null_class_builder/commands/traceable.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Records the source location where a null object was created
Instance Attribute Summary
Attributes inherited from Naught::NullClassBuilder::Command
Instance Method Summary collapse
-
#call ⇒ void
private
Install the traceable initializer.
Methods inherited from Naught::NullClassBuilder::Command
Constructor Details
This class inherits a constructor from Naught::NullClassBuilder::Command
Instance Method Details
#call ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Install the traceable initializer
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/naught/null_class_builder/commands/traceable.rb', line 13 def call defer_prepend_module do attr_reader :__file__, :__line__ define_method(:initialize) do | = {}| backtrace = .fetch(:caller) { Kernel.caller(3) } caller_data = Naught::CallerInfo.parse(backtrace[0]) @__file__ = caller_data[:path] @__line__ = caller_data[:lineno] super() end end end |