lib/code_ownership/private.rb in code_ownership-1.32.2 vs lib/code_ownership/private.rb in code_ownership-1.32.3
- old
+ new
@@ -56,13 +56,13 @@
end
end
# Returns a string version of the relative path to a Rails constant,
# or nil if it can't find something
- sig { params(klass_string: T.nilable(String)).returns(T.nilable(String)) }
- def self.path_from_klass_string(klass_string)
- if klass_string
- path = Object.const_source_location(klass_string)&.first
+ sig { params(klass: T.nilable(T.any(Class, Module))).returns(T.nilable(String)) }
+ def self.path_from_klass(klass)
+ if klass
+ path = Object.const_source_location(klass.to_s)&.first
(path && Pathname.new(path).relative_path_from(Pathname.pwd).to_s) || nil
else
nil
end
end