Class: Pathname
- Inherits:
-
Object
- Object
- Pathname
- Defined in:
- lib/microstation/ext/pathname.rb
Instance Method Summary collapse
Instance Method Details
#ext(newext = "") ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/microstation/ext/pathname.rb', line 4 def ext(newext = "") str = to_s return dup if [".", ".."].include? str if newext != "" newext = (newext =~ /^\./) ? newext : ("." + newext) end Pathname.new(str.dup.sub!(%r{([^/\\])\.[^./\\]*$}) { ::Regexp.last_match(1) + newext } || str + newext) end |
#extstr(newext = "") ⇒ Object
14 15 16 |
# File 'lib/microstation/ext/pathname.rb', line 14 def extstr(newext = "") Pathname.new(to_s.ext(newext)) end |
#glob(pattern) ⇒ Object
18 19 20 |
# File 'lib/microstation/ext/pathname.rb', line 18 def glob(pattern) self.class.glob("#{self}/#{pattern}") end |