10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/kind/immutable_attributes/initializer.rb', line 10
def initialize(arg)
input = __resolve_attribute_input(arg)
hash = call_before_initialize_to_prepare_the_input(input)
@_nil_attrs = ::Set.new
@_____attrs = {}
@attributes = {}
self.class.__attributes__.each do |name, (kind, default, visibility)|
value_to_assign = __resolve_attribute_value_to_assign(kind, default, hash, name)
@_nil_attrs << name if value_to_assign.nil?
@_____attrs[name] = value_to_assign
@attributes[name] = value_to_assign if visibility == :public
instance_variable_set("@#{name}", value_to_assign)
end
@_nil_attrs.freeze
@attributes.freeze
call_after_initialize_and_assign_the_attributes
end
|