Class: Attrify::VariantConfig
Defined Under Namespace
Modules: MergeableAttributes
Instance Method Summary
collapse
#<<
Constructor Details
17
18
19
20
21
|
# File 'lib/attrify/variant_config.rb', line 17
def initialize(*args)
super
self.default_proc = proc { |hash, key| hash[key] = self.class.new }
end
|
Instance Method Details
#[]=(key, value) ⇒ Object
23
24
25
26
27
28
29
|
# File 'lib/attrify/variant_config.rb', line 23
def []=(key, value)
if value.is_a?(Hash) && !value.is_a?(self.class)
value = self.class.new.merge(value)
end
super
end
|
#set(**args) ⇒ Object
31
32
33
34
35
|
# File 'lib/attrify/variant_config.rb', line 31
def set(**args)
clear
merge!(args)
self
end
|