50d7c356c2
Signed-off-by: Rémy Coutable <remy@rymai.me>
24 lines
502 B
Ruby
24 lines
502 B
Ruby
module Gitlab
|
|
module View
|
|
module Presenter
|
|
class Factory
|
|
def initialize(subject, **attributes)
|
|
@subject = subject
|
|
@attributes = attributes
|
|
end
|
|
|
|
def fabricate!
|
|
presenter_class.new(subject, attributes)
|
|
end
|
|
|
|
private
|
|
|
|
attr_reader :subject, :attributes
|
|
|
|
def presenter_class
|
|
attributes.delete(:presenter_class) { "#{subject.class.name}Presenter".constantize }
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|