mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-14 18:01:42 +00:00
24 lines
346 B
Ruby
24 lines
346 B
Ruby
# frozen_string_literal: true
|
|
|
|
# Un campo numérico
|
|
class MetadataNumber < MetadataTemplate
|
|
# Nada
|
|
def default_value
|
|
super || nil
|
|
end
|
|
|
|
def save
|
|
return true unless changed?
|
|
|
|
self[:value] = value.to_i
|
|
self[:value] = encrypt(value) if private?
|
|
|
|
true
|
|
end
|
|
|
|
private
|
|
|
|
def decrypt(value)
|
|
super(value).to_i
|
|
end
|
|
end
|