Class: T::Props::Private::ApplyEmptyHashDefault
- Inherits:
-
ApplyDefault
- Object
- ApplyDefault
- T::Props::Private::ApplyEmptyHashDefault
- Defined in:
- lib/types/props/private/apply_default.rb
Overview
Special case since it’s so common, and a literal ‘{}` is meaningfully faster than falling back to ApplyComplexDefault or even calling `some_empty_hash.dup`
Constant Summary
Constants inherited from ApplyDefault
T::Props::Private::ApplyDefault::NO_CLONE_TYPES
Constants included from Helpers
Instance Attribute Summary
Attributes inherited from ApplyDefault
Instance Method Summary collapse
Methods inherited from ApplyDefault
Methods included from Sig
Methods included from Helpers
#abstract!, #final!, #interface!, #mixes_in_class_methods, #requires_ancestor, #sealed!
Constructor Details
This class inherits a constructor from T::Props::Private::ApplyDefault
Instance Method Details
#default ⇒ Object
132 133 134 |
# File 'lib/types/props/private/apply_default.rb', line 132 def default {} end |
#set_default(instance) ⇒ Object
126 127 128 |
# File 'lib/types/props/private/apply_default.rb', line 126 def set_default(instance) instance.instance_variable_set(@accessor_key, {}) end |