Class: Naught::NullClassBuilder::Commands::NullSafeProxy Private
- Inherits:
-
Naught::NullClassBuilder::Command
- Object
- Naught::NullClassBuilder::Command
- Naught::NullClassBuilder::Commands::NullSafeProxy
- Defined in:
- lib/naught/null_class_builder/commands/null_safe_proxy.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.
Enables null-safe proxy wrapping via the NullSafe() conversion function
When enabled, the generated null class gains a NullSafe() function that wraps any value in a proxy. The proxy intercepts all method calls and wraps return values, replacing nil with the null object.
Instance Attribute Summary
Attributes inherited from Naught::NullClassBuilder::Command
Instance Method Summary collapse
-
#call ⇒ void
private
Install the NullSafe conversion function.
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 NullSafe conversion function
33 34 35 36 37 38 39 40 |
# File 'lib/naught/null_class_builder/commands/null_safe_proxy.rb', line 33 def call null_equivs = builder.null_equivalents defer_class do |null_class| proxy_class = build_proxy_class(null_class, null_equivs) null_class.const_set(:NullSafeProxy, proxy_class) install_null_safe_conversion(null_class, proxy_class, null_equivs) end end |