class T::Props::Private::ApplyDefault
def self.for(cls, rules)
def self.for(cls, rules) accessor_key = rules.fetch(:accessor_key) setter = rules.fetch(:setter_proc) if rules.key?(:factory) ApplyDefaultFactory.new(cls, rules.fetch(:factory), accessor_key, setter) elsif rules.key?(:default) default = rules.fetch(:default) case default when *NO_CLONE_TYPES return ApplyPrimitiveDefault.new(default, accessor_key, setter) when String if default.frozen? return ApplyPrimitiveDefault.new(default, accessor_key, setter) end when Array if default.empty? && default.class == Array return ApplyEmptyArrayDefault.new(accessor_key, setter) end when Hash if default.empty? && default.default.nil? && T.unsafe(default).default_proc.nil? && default.class == Hash return ApplyEmptyHashDefault.new(accessor_key, setter) end end ApplyComplexDefault.new(default, accessor_key, setter) else nil end end
def default; end
def default; end
def initialize(accessor_key, setter_proc)
def initialize(accessor_key, setter_proc) @accessor_key = T.let(accessor_key, Symbol) @setter_proc = T.let(setter_proc, SetterFactory::SetterProc) end
def set_default(instance); end
def set_default(instance); end