Class: T::Props::Private::ApplyEmptyHashDefault

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_hash.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



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