Class: Pathname
Instance Method Summary collapse
- #_original_sub ⇒ Object
- #find_up(rel_path, **kwds) ⇒ return_type
- #find_up!(rel_path, **kwds) ⇒ return_type
-
#start_with?(*prefixes) ⇒ Boolean
override to accept Pathname instances.
-
#sub(pattern, replacement) ⇒ Pathname
override sub to support Pathname instances as patterns.
-
#to_pn ⇒ Pathname
Just returns ‘self`.
Instance Method Details
#_original_sub ⇒ Object
18 |
# File 'lib/nrser/core_ext/pathname.rb', line 18 alias_method :_original_sub, :sub |
#find_up(rel_path, **kwds) ⇒ return_type
TODO:
Document find_root method.
Returns @todo Document return value.
60 61 62 |
# File 'lib/nrser/core_ext/pathname.rb', line 60 def find_up rel_path, **kwds NRSER.find_up rel_path, **kwds, from: self end |
#find_up!(rel_path, **kwds) ⇒ return_type
TODO:
Document find_root method.
Returns @todo Document return value.
73 74 75 |
# File 'lib/nrser/core_ext/pathname.rb', line 73 def find_up! rel_path, **kwds NRSER.find_up! rel_path, **kwds, from: self end |
#start_with?(*prefixes) ⇒ Boolean
override to accept Pathname instances.
13 14 15 |
# File 'lib/nrser/core_ext/pathname.rb', line 13 def start_with? *prefixes to_s.start_with? *prefixes.map(&:to_s) end |
#sub(pattern, replacement) ⇒ Pathname
override sub to support Pathname instances as patterns.
32 33 34 35 36 37 38 39 |
# File 'lib/nrser/core_ext/pathname.rb', line 32 def sub pattern, replacement case pattern when Pathname _original_sub pattern.to_s, replacement else _original_sub pattern, replacement end end |
#to_pn ⇒ Pathname
Just returns ‘self`. Implemented to match the String#to_pn API so it can be called on an argument that may be either one.
47 48 49 |
# File 'lib/nrser/core_ext/pathname.rb', line 47 def to_pn self end |