mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-26 10:56:22 +00:00
caché de la fábrica de metadatos
This commit is contained in:
parent
32313e595c
commit
e3bb7b826d
1 changed files with 3 additions and 1 deletions
|
@ -3,6 +3,8 @@
|
||||||
# Devuelve metadatos de cierto tipo
|
# Devuelve metadatos de cierto tipo
|
||||||
class MetadataFactory
|
class MetadataFactory
|
||||||
def self.build(**args)
|
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
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue