summaryrefslogtreecommitdiff
path: root/lib/gitlab/view/presenter/factory.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/view/presenter/factory.rb')
-rw-r--r--lib/gitlab/view/presenter/factory.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/gitlab/view/presenter/factory.rb b/lib/gitlab/view/presenter/factory.rb
new file mode 100644
index 00000000000..d172d61e2c9
--- /dev/null
+++ b/lib/gitlab/view/presenter/factory.rb
@@ -0,0 +1,24 @@
+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