2019-08-06 17:54:17 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# Devuelve metadatos de cierto tipo
|
|
|
|
class MetadataFactory
|
2021-02-17 21:41:42 +00:00
|
|
|
class << self
|
|
|
|
def build(**args)
|
|
|
|
classify(args[:type]).new(**args)
|
|
|
|
end
|
|
|
|
|
|
|
|
def classify(type)
|
|
|
|
@factory_cache ||= {}
|
|
|
|
@factory_cache[type] ||= ('Metadata' + type.to_s.camelcase).constantize
|
|
|
|
end
|
2019-08-06 17:54:17 +00:00
|
|
|
end
|
|
|
|
end
|