debian-mirror-gitlab/lib/gitlab/view/presenter/factory.rb

25 lines
462 B
Ruby
Raw Normal View History

2017-08-17 22:00:37 +05:30
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