Module: NRSER::Ext::Pathname
- Defined in:
- lib/nrser/ext/pathname.rb
Instance Method Summary collapse
- #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
#find_up(rel_path, **kwds) ⇒ return_type
TODO:
Document find_root method.
Returns @todo Document return value.
57 58 59 |
# File 'lib/nrser/ext/pathname.rb', line 57 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.
70 71 72 |
# File 'lib/nrser/ext/pathname.rb', line 70 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/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.
29 30 31 32 33 34 35 36 |
# File 'lib/nrser/ext/pathname.rb', line 29 def sub pattern, replacement case pattern when Pathname super pattern.to_s, replacement else super 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.
44 45 46 |
# File 'lib/nrser/ext/pathname.rb', line 44 def to_pn self end |