Skip to content

Commit fa5cf7c

Browse files
authored
Merge pull request #23 from zitadel/fix-redeclaration-warnings
Suppress method-redefined warnings in generated Ruby SDK models
2 parents 63863da + fb62339 commit fa5cf7c

7 files changed

Lines changed: 32 additions & 4 deletions

File tree

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ gemspec
66

77
gem 'oauth2'
88
gem 'typhoeus'
9+
gem 'warning'
910
gem 'zeitwerk'
1011

1112
group :development do

Gemfile.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ GEM
167167
unicode-display_width (2.6.0)
168168
uri (1.0.3)
169169
version_gem (1.1.7)
170+
warning (1.5.0)
170171
zeitwerk (2.6.18)
171172

172173
PLATFORMS
@@ -190,6 +191,7 @@ DEPENDENCIES
190191
steep
191192
testcontainers
192193
typhoeus
194+
warning
193195
zeitwerk
194196
zitadel-client!
195197

lib/patch.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
module OAuth2
44
module Strategy
5-
# noinspection RbsMissingTypeSignature
6-
class Assertion < Base
5+
# rubocop:disable Style/Documentation
6+
module AssertionPatch
77
private
88

9+
# noinspection RbsMissingTypeSignature
910
def build_assertion(claims, opts)
1011
raise ArgumentError, 'encoding_opts must include :algorithm and :key' unless
1112
opts.is_a?(Hash) && opts.key?(:algorithm) && opts.key?(:key)
@@ -14,5 +15,10 @@ def build_assertion(claims, opts)
1415
JWT.encode(claims, opts[:key], opts[:algorithm], headers)
1516
end
1617
end
18+
# rubocop:enable Style/Documentation
19+
20+
class Assertion < Base
21+
prepend AssertionPatch
22+
end
1723
end
1824
end

lib/zitadel_client.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22

33
require 'zeitwerk'
44
require 'oauth2'
5+
require 'warning'
56
require_relative 'patch'
67

8+
Warning.ignore(:method_redefined, __dir__)
9+
710
# Main entrypoint for the ZitadelClient Ruby SDK.
811
#
912
# This module encapsulates all functionality for authenticating with and accessing

sig/lib/warning/warning.rbs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module Warning
2+
def self.ignore: (Regexp | Symbol | Array[Symbol], String?) -> void
3+
end

spec/spec_helper.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,17 @@
1717
# Override the HTMLFormatter so that it writes its report inside build/coverage/html
1818
module SimpleCov
1919
module Formatter
20-
class HTMLFormatter
20+
# rubocop:disable Style/Documentation
21+
module HTMLFormatterPatch
2122
def output_path
2223
File.join(SimpleCov.coverage_path, 'html')
2324
end
2425
end
26+
# rubocop:enable Style/Documentation
27+
28+
class HTMLFormatter
29+
prepend HTMLFormatterPatch
30+
end
2531
end
2632
end
2733

test/test_helper.rb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# frozen_string_literal: true
22

3+
require 'warning'
34
require 'dotenv'
45
require 'simplecov'
56
require 'simplecov-lcov'
@@ -17,11 +18,17 @@
1718
# Override the HTMLFormatter so that it writes its report inside build/coverage/html
1819
module SimpleCov
1920
module Formatter
20-
class HTMLFormatter
21+
# rubocop:disable Style/Documentation
22+
module HTMLFormatterPatch
2123
def output_path
2224
File.join(SimpleCov.coverage_path, 'html')
2325
end
2426
end
27+
# rubocop:enable Style/Documentation
28+
29+
class HTMLFormatter
30+
prepend HTMLFormatterPatch
31+
end
2532
end
2633
end
2734

0 commit comments

Comments
 (0)