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
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue