File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ def self.create_code_team(attributes)
4747
4848 code_team = CodeTeams ::Team . new (
4949 config_yml : 'tmp/fake_config.yml' ,
50- raw_hash : T . cast ( deep_stringify_keys ( attributes ) , T ::Hash [ T . untyped , T . untyped ] )
50+ raw_hash : T . cast ( Utils . deep_stringify_keys ( attributes ) , T ::Hash [ T . untyped , T . untyped ] )
5151 )
5252
5353 code_teams << code_team
@@ -68,21 +68,6 @@ def self.reset!
6868 Thread . current [ THREAD_KEY ] = [ ]
6969 end
7070
71- sig { params ( value : T . untyped ) . returns ( T . untyped ) }
72- def self . deep_stringify_keys ( value )
73- case value
74- when Hash
75- value . each_with_object ( { } ) do |( k , v ) , acc |
76- acc [ k . to_s ] = deep_stringify_keys ( v )
77- end
78- when Array
79- value . map { |v | deep_stringify_keys ( v ) }
80- else
81- value
82- end
83- end
84- private_class_method :deep_stringify_keys
85-
8671 module CodeTeamsExtension
8772 extend T ::Sig
8873
Original file line number Diff line number Diff line change @@ -13,5 +13,18 @@ def underscore(string)
1313 def demodulize ( string )
1414 string . split ( '::' ) . last
1515 end
16+
17+ def deep_stringify_keys ( value )
18+ case value
19+ when Hash
20+ value . each_with_object ( { } ) do |( k , v ) , acc |
21+ acc [ k . to_s ] = deep_stringify_keys ( v )
22+ end
23+ when Array
24+ value . map { |v | deep_stringify_keys ( v ) }
25+ else
26+ value
27+ end
28+ end
1629 end
1730end
You can’t perform that action at this time.
0 commit comments