Class: T::Props::Private::ApplyEmptyArrayDefault
- Inherits:
-
ApplyDefault
- Object
- ApplyDefault
- T::Props::Private::ApplyEmptyArrayDefault
- 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_array.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
115 116 117 |
# File 'lib/types/props/private/apply_default.rb', line 115 def default [] end |
#set_default(instance) ⇒ Object
109 110 111 |
# File 'lib/types/props/private/apply_default.rb', line 109 def set_default(instance) instance.instance_variable_set(@accessor_key, []) end |