ruby / ruby/rbs

Is `:perm` missing in `IO.write` and `Pathname#write`?

Open
#335 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
2.2k
Forks
256
Avg merge
6d 17h
Merged PRs (30d)
37

Description

I noticed that the IO.write and Pathname#write method definitions do not have a :perm option.

https://github.com/ruby/rbs/blob/c922491270703787716c022774ad7c8e61db1529/stdlib/builtin/io.rbs#L531

https://github.com/ruby/rbs/blob/c922491270703787716c022774ad7c8e61db1529/stdlib/pathname/pathname.rbs#L1029-L1039

The related IO.write document says:

:perm
integer
Specifies the perm argument for open().

Then, I have the following questions:

  • Is there some reason for the missing :perm option?

  • Can we unify the common options' definitions? And does it make sense? Like this:

    # IO
    def self.write: (String name, _ToS content, ?Integer offset, ?open_args options) -> Integer
    
    # Pathname
    def write: (String content, ?Integer offset, ?open_args options) -> 
    

See also:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with stdlib/builtin/io.rbs around line 531 and stdlib/pathname/pathname.rbs around lines 1029-1039, then compare the linked IO and Pathname documentation for their write options. Determine whether :perm is missing and whether the shared options should be represented consistently; done means the signatures and any rationale match the documented APIs.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.