2019-03-26 15:32:20 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-01-02 17:19:25 +00:00
|
|
|
class ApplicationRecord < ActiveRecord::Base
|
|
|
|
self.abstract_class = true
|
2024-04-15 19:58:55 +00:00
|
|
|
|
|
|
|
# Obtener una lista filtrada de atributos al momento de serializar
|
|
|
|
#
|
2024-04-15 20:10:19 +00:00
|
|
|
# @return [String]
|
2024-04-15 19:58:55 +00:00
|
|
|
def to_yaml(options = {})
|
2024-05-02 21:49:29 +00:00
|
|
|
pruned_attributes.to_yaml(options)
|
|
|
|
end
|
|
|
|
|
|
|
|
# Devuelve todos los atributos menos los filtrados
|
|
|
|
#
|
|
|
|
# @return [Hash]
|
|
|
|
def pruned_attributes
|
|
|
|
self.class.inspection_filter.filter(serializable_hash)
|
|
|
|
end
|
|
|
|
|
|
|
|
# @param coder [Psych::Coder]
|
|
|
|
# @return nil
|
|
|
|
def encode_with(coder)
|
|
|
|
pruned_attributes.each_pair do |attr, value|
|
|
|
|
coder[attr] = value
|
|
|
|
end
|
|
|
|
|
|
|
|
nil
|
2024-04-15 19:58:55 +00:00
|
|
|
end
|
2018-01-02 17:19:25 +00:00
|
|
|
end
|