Class: Alchemy::Configuration::ClassOption
Instance Attribute Summary
Attributes inherited from BaseOption
#name
Instance Method Summary
collapse
Methods inherited from BaseOption
#==, #hash, #initialize, #raw_value, value_class
Instance Method Details
#allowed_classes ⇒ Object
8
9
10
|
# File 'lib/alchemy/configuration/class_option.rb', line 8
def allowed_classes
[String, Array]
end
|
#validate(value) ⇒ Object
12
13
14
15
16
17
18
|
# File 'lib/alchemy/configuration/class_option.rb', line 12
def validate(value)
super
if value.is_a?(Array)
validate_array!(value)
end
end
|
#value ⇒ Object
20
21
22
23
24
25
26
27
28
|
# File 'lib/alchemy/configuration/class_option.rb', line 20
def value
@_cached_value ||= case @value
when Array
@value[0] = @value[0]&.constantize
@value
when String
@value&.constantize
end
end
|