5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-14 22:31:41 +00:00

caché de la fábrica de metadatos

This commit is contained in:
f 2020-10-03 22:31:37 -03:00
parent 32313e595c
commit e3bb7b826d

View file

@ -3,6 +3,8 @@
# Devuelve metadatos de cierto tipo
class MetadataFactory
def self.build(**args)
"Metadata#{args[:type].camelcase}".constantize.new(args)
@@factory_cache ||= {}
@@factory_cache[args[:type]] ||= ('Metadata' + args[:type].to_s.camelcase).constantize
@@factory_cache[args[:type]].new(args)
end
end