gitlab-org--gitlab-foss/lib/gitlab/view/presenter/factory.rb
Rémy Coutable 061bb6eb6e More improvements to presenters
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-01-18 16:38:35 +01:00

24 lines
462 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
"#{subject.class.name}Presenter".constantize
end
end
end
end
end