2020-03-24 22:11:30 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# Un campo numérico
|
|
|
|
class MetadataNumber < MetadataTemplate
|
|
|
|
# Nada
|
|
|
|
def default_value
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
|
|
|
def save
|
|
|
|
self[:value] = value.to_i
|
2020-08-20 23:38:31 +00:00
|
|
|
self[:value] = encrypt(value) if private?
|
2020-03-24 22:11:30 +00:00
|
|
|
|
|
|
|
true
|
|
|
|
end
|
2020-08-20 23:38:31 +00:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def decrypt(value)
|
|
|
|
super(value).to_i
|
|
|
|
end
|
2020-03-24 22:11:30 +00:00
|
|
|
end
|