-
Notifications
You must be signed in to change notification settings - Fork 216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[socket] Add RBS file for "socket" #699
Conversation
core/socket.rbs
Outdated
# could be called like this: | ||
# sock.setsockopt(:SOCKET, :REUSEADDR, true) | ||
# sock.setsockopt(Socket::SOL_SOCKET,Socket::SO_REUSEADDR, true) | ||
# sock.setsockopt(Socket::Option.bool(:INET, :SOCKET, :REUSEADDR, true)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Goodcheck] Prefer
boolish
overbool
for method arguments and block return values (view)See the doc below:
https://github.com/ruby/rbs/blob/78d04a2db0f1c4925d2b13c2939868edf9465d6c/docs/syntax.md#bool-or-boolish
Rule rbs.prefer_boolish
You can close this issue if no need to fix it. Learn more.
This is a false detection. Closing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really appreciate this great work! 🙏
I want to ask you to change the file name.
- Could you move the file under
stdlib/socket/0
directory, becausesocket
is not built-in? - How about splitting files for each classes, like
basic_socket.rbs
,socket.rbs
, ...? (This is optional but would make reading and future updates easier.)
core/socket.rbs
Outdated
|
||
private | ||
|
||
def __recv_nonblock: (untyped, untyped, untyped, untyped) -> untyped |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fine to leave it as is, I suppose? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. It's fine to leave the defs here.
@soutaro thx. Just committed the changes you proposed. hope it's fine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much! 👍
# Socket.new(:UNIX, :STREAM) # UNIX stream socket | ||
# Socket.new(:UNIX, :DGRAM) # UNIX datagram socket | ||
# | ||
def initialize: (Symbol domain, Symbol socktype, ?Integer protocol) -> untyped |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems we can write socket = Socket.new(Socket::AF_INET, Socket::SOCK_STREAM, 0)
where the parameters are Integer
?
Added RBS signatures for the "socket" package (no tests).