Project

General

Profile

Actions

Feature #9625

closed

Define `Pathname#/` to append to the path

Added by alexeymuranov (Alexey Muranov) over 10 years ago. Updated almost 3 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:61432]

Description

How about borrowing this definition from Homebrew project:

class Pathname
  def / that
    join that.to_s
  end
end

Looks nice to me.

Updated by avdi (Avdi Grimm) over 10 years ago

Didn't this exist once and was later taken out? I have a dim (possibly
false) memory of this.

--
Avdi Grimm
http://avdi.org
On Mar 12, 2014 5:12 AM, wrote:

Issue #9625 has been reported by Alexey Muranov.


Feature #9625: Define Pathname#/ to append to the path
https://bugs.ruby-lang.org/issues/9625

  • Author: Alexey Muranov
  • Status: Open
  • Priority: Normal
  • Assignee:
  • Category:
  • Target version:

How about borrowing this definition from Homebrew project:

class Pathname
  def / that
    join that.to_s
  end
end

Looks nice to me.

--
http://bugs.ruby-lang.org/

Updated by akr (Akira Tanaka) over 10 years ago

I feel this proposal is acceptable.

Updated by alexeymuranov (Alexey Muranov) over 10 years ago

I am not sure, however, if the type conversion .to_s is a good idea: i think it will be easier to remember if #/ will be just a synonyme of #join, and would help to catch some bugs early.

Updated by trans (Thomas Sawyer) over 10 years ago

+1 This is a no-brainer.

Updated by akr (Akira Tanaka) over 10 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

Applied in changeset ruby-trunk:r45826.


  • ext/pathname/lib/pathname.rb (Pathname#/): Aliased to Pathname#+.
    Suggested by Alexey Muranov. [ruby-core:61432] [Feature #9625]
Actions #6

Updated by hsbt (Hiroshi SHIBATA) almost 3 years ago

  • Project changed from 14 to Ruby master
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0