mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-14 17:41:41 +00:00
15 lines
323 B
Ruby
15 lines
323 B
Ruby
# frozen_string_literal: true
|
|
|
|
# Devuelve metadatos de cierto tipo
|
|
class MetadataFactory
|
|
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
|
|
end
|
|
end
|