mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-16 06:01:42 +00:00
hacer más claro el código
This commit is contained in:
parent
090b630525
commit
d67d43ff1e
1 changed files with 8 additions and 4 deletions
|
@ -25,10 +25,14 @@ class MetadataBoolean < MetadataTemplate
|
|||
# * false
|
||||
# * true
|
||||
def value
|
||||
return document.data.fetch(name.to_s, default_value) if self[:value].nil?
|
||||
return self[:value] unless self[:value].is_a? String
|
||||
|
||||
self[:value] = true_values.include? self[:value]
|
||||
case self[:value]
|
||||
when NilClass
|
||||
document.data.fetch(name.to_s, default_value)
|
||||
when String
|
||||
true_values.include? self[:value]
|
||||
else
|
||||
self[:value]
|
||||
end
|
||||
end
|
||||
|
||||
# Siempre guardar el valor de este campo a menos que sea nulo
|
||||
|
|
Loading…
Reference in a new issue