ruby / ruby/pathname

Add `Pathname#touch` as a facade for `FileUtils.touch`

Open
#72 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
32
Forks
24
Avg merge
13h 2m
Merged PRs (30d)
1

Description

Hello,

I am in the process to refactoring some code by replacing usage of File and FileUtils with Pathnames and I was surprised to discover that Pathname#touch does not exist.

Would a pull request for such a method be considered?

Definition of Done

Simple usecase

path = Pathname.new('file.txt')
path.touch

# Would be strictly equivalent to:
FileUtils.touch('file.txt')

With all the optional arguments

path = Pathname.new('file.txt')
time = Time.now - 3600
path.touch(mtime: time, nocreate: true, noop: true, verbose: true)

# Would be strictly equivalent to:
FileUtils.touch('file.txt', mtime: time, nocreate: true, noop: true, verbose: true)

Contributor guide

No contributing guide indexed for this repository

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 at the Pathname API entry point for adding a touch method, then compare its arguments with FileUtils.touch. Done means Pathname#touch supports the simple call and the listed mtime, nocreate, noop, and verbose options with equivalent behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
operating-systems
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.