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 ...@@ -5,13 +5,13 @@ module Presentable
class_methods do class_methods do
def present(attributes) def present(attributes)
all.map { |klass_object| klass_object.present(attributes) } all.map { |klass_object| klass_object.present(**attributes) }
end end
end end
def present(**attributes) def present(**attributes)
Gitlab::View::Presenter::Factory Gitlab::View::Presenter::Factory
.new(self, attributes) .new(self, **attributes)
.fabricate! .fabricate!
end end
end end
...@@ -8,7 +8,7 @@ class ClusterablePresenter < Gitlab::View::Presenter::Delegated ...@@ -8,7 +8,7 @@ class ClusterablePresenter < Gitlab::View::Presenter::Delegated
attributes_with_presenter_class = attributes.merge(presenter_class: presenter_class) attributes_with_presenter_class = attributes.merge(presenter_class: presenter_class)
Gitlab::View::Presenter::Factory Gitlab::View::Presenter::Factory
.new(clusterable, attributes_with_presenter_class) .new(clusterable, **attributes_with_presenter_class)
.fabricate! .fabricate!
end end
......
...@@ -8,7 +8,7 @@ class InstanceClusterablePresenter < ClusterablePresenter ...@@ -8,7 +8,7 @@ class InstanceClusterablePresenter < ClusterablePresenter
attributes_with_presenter_class = attributes.merge(presenter_class: InstanceClusterablePresenter) attributes_with_presenter_class = attributes.merge(presenter_class: InstanceClusterablePresenter)
Gitlab::View::Presenter::Factory Gitlab::View::Presenter::Factory
.new(clusterable, attributes_with_presenter_class) .new(clusterable, **attributes_with_presenter_class)
.fabricate! .fabricate!
end end
......
...@@ -4,7 +4,7 @@ require 'spec_helper' ...@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec.describe SubscriptionPresenter do RSpec.describe SubscriptionPresenter do
let(:subscription) { create(:gitlab_subscription) } let(:subscription) { create(:gitlab_subscription) }
let(:presenter) { described_class.new(subscription, {}) } let(:presenter) { described_class.new(subscription) }
describe '#plan' do describe '#plan' do
subject { presenter.plan } subject { presenter.plan }
......
...@@ -23,7 +23,7 @@ module API ...@@ -23,7 +23,7 @@ module API
def initialize(object, options = {}) def initialize(object, options = {})
options = options.opts_hash if options.is_a?(Grape::Entity::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 end
end end
......
...@@ -10,7 +10,7 @@ module Gitlab ...@@ -10,7 +10,7 @@ module Gitlab
end end
def fabricate! def fabricate!
presenter_class.new(subject, attributes) presenter_class.new(subject, **attributes)
end end
private 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