Commit a25f6132 authored by Thong Kuah's avatar Thong Kuah

Fix Ruby 2.7 kwarg warnings for presenters

It is possible to switch to hashes but current calls already use keyword
arguments so let's stick with kwags for now.
parent 30fde3b8
......@@ -5,13 +5,13 @@ module Presentable
class_methods do
def present(attributes)
all.map { |klass_object| klass_object.present(attributes) }
all.map { |klass_object| klass_object.present(**attributes) }
end
end
def present(**attributes)
Gitlab::View::Presenter::Factory
.new(self, attributes)
.new(self, **attributes)
.fabricate!
end
end
......@@ -8,7 +8,7 @@ class ClusterablePresenter < Gitlab::View::Presenter::Delegated
attributes_with_presenter_class = attributes.merge(presenter_class: presenter_class)
Gitlab::View::Presenter::Factory
.new(clusterable, attributes_with_presenter_class)
.new(clusterable, **attributes_with_presenter_class)
.fabricate!
end
......
......@@ -8,7 +8,7 @@ class InstanceClusterablePresenter < ClusterablePresenter
attributes_with_presenter_class = attributes.merge(presenter_class: InstanceClusterablePresenter)
Gitlab::View::Presenter::Factory
.new(clusterable, attributes_with_presenter_class)
.new(clusterable, **attributes_with_presenter_class)
.fabricate!
end
......
......@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe SubscriptionPresenter do
let(:subscription) { create(:gitlab_subscription) }
let(:presenter) { described_class.new(subscription, {}) }
let(:presenter) { described_class.new(subscription) }
describe '#plan' do
subject { presenter.plan }
......
......@@ -23,7 +23,7 @@ module API
def initialize(object, options = {})
options = options.opts_hash if options.is_a?(Grape::Entity::Options)
super(object.present(options), **options)
super(object.present(**options), options)
end
end
end
......
......@@ -10,7 +10,7 @@ module Gitlab
end
def fabricate!
presenter_class.new(subject, attributes)
presenter_class.new(subject, **attributes)
end
private
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment