Skip to content

Commit 305f3a4

Browse files
committed
Refactor kw_args handling by using argument forwarding operator
1 parent 5d0a343 commit 305f3a4

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
strategy:
99
fail-fast: false
1010
matrix:
11-
ruby: ['2.5', '2.6', '2.7', '3.0', '3.1', '3.2', '3.3', 'head']
11+
ruby: ['2.7', '3.0', '3.1', '3.2', '3.3', '3.4', 'head']
1212
steps:
1313
- uses: actions/checkout@v3
1414
- uses: ruby/setup-ruby@v1

lib/serviz.rb

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,8 @@ module Serviz
44
class Base
55
attr_accessor :errors, :result
66

7-
def self.call(*args, **kwargs)
8-
instance = if args.length > 0 && kwargs.length > 0
9-
new(*args, **kwargs)
10-
elsif kwargs.length > 0
11-
new(**kwargs)
12-
else
13-
new(*args)
14-
end
7+
def self.call(...)
8+
instance = new(...)
159
instance.call
1610

1711
yield(instance) if block_given?

0 commit comments

Comments
 (0)