Class: T::Props::Private::ApplyEmptyArrayDefault

Inherits:
ApplyDefault
  • Object
show all
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

Helpers::Private

Instance Attribute Summary

Attributes inherited from ApplyDefault

#setter_proc

Instance Method Summary collapse

Methods inherited from ApplyDefault

for, #initialize

Methods included from Sig

#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

#defaultObject



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