Skip to content

Commit

Permalink
Add annotations for phonelib
Browse files Browse the repository at this point in the history
  • Loading branch information
olivier-thatch committed Feb 7, 2024
1 parent 7e3ff3d commit 4d0a069
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
2 changes: 2 additions & 0 deletions index.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@
},
"parse-cron": {
},
"phonelib": {
},
"pundit": {
},
"railties": {
Expand Down
39 changes: 39 additions & 0 deletions rbi/annotations/phonelib.rbi
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# typed: true

module Phonelib
module Core
sig do
params(country: T.nilable(T.any(String, Symbol, T::Array[T.any(String, Symbol)])))
.returns(T.nilable(T.any(String, Symbol, T::Array[T.any(String, Symbol)])))
end
def default_country=(country); end

sig { params(phone: String, passed_country: T.nilable(T.any(String, Symbol))).returns(Phonelib::Phone) }
def parse(phone, passed_country = nil); end
end

class Phone
sig { params(phone: String, country: T.nilable(T.any(String, Symbol))).void }
def initialize(phone, country = nil); end

sig { returns(T::Boolean) }
def valid?; end

sig { returns(T::Boolean) }
def invalid?; end

sig { returns(T::Boolean) }
def possible?; end

sig { returns(T::Boolean) }
def impossible?; end
end

module PhoneFormatter
sig { params(formatted: T::Boolean).returns(String) }
def national(formatted = true); end

sig { returns(String) }
def country_code; end
end
end

0 comments on commit 4d0a069

Please sign in to comment.