PATH: typed: strict
This commit is contained in:
parent
b72544eb04
commit
1c9f084bcc
@ -1,4 +1,4 @@
|
|||||||
# typed: true # rubocop:todo Sorbet/StrictSigil
|
# typed: strict
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "forwardable"
|
require "forwardable"
|
||||||
@ -7,16 +7,18 @@ require "forwardable"
|
|||||||
class PATH
|
class PATH
|
||||||
include Enumerable
|
include Enumerable
|
||||||
extend Forwardable
|
extend Forwardable
|
||||||
|
extend T::Generic
|
||||||
|
|
||||||
delegate each: :@paths
|
delegate each: :@paths
|
||||||
|
|
||||||
|
Elem = type_member(:out) { { fixed: String } }
|
||||||
Element = T.type_alias { T.nilable(T.any(Pathname, String, PATH)) }
|
Element = T.type_alias { T.nilable(T.any(Pathname, String, PATH)) }
|
||||||
private_constant :Element
|
private_constant :Element
|
||||||
Elements = T.type_alias { T.any(Element, T::Array[Element]) }
|
Elements = T.type_alias { T.any(Element, T::Array[Element]) }
|
||||||
private_constant :Elements
|
private_constant :Elements
|
||||||
sig { params(paths: Elements).void }
|
sig { params(paths: Elements).void }
|
||||||
def initialize(*paths)
|
def initialize(*paths)
|
||||||
@paths = parse(paths)
|
@paths = T.let(parse(paths), T::Array[String])
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { params(paths: Elements).returns(T.self_type) }
|
sig { params(paths: Elements).returns(T.self_type) }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user