Class: Pathname

Inherits:
Object
  • Object
show all
Defined in:
lib/microstation/ext/pathname.rb

Instance Method Summary collapse

Instance Method Details

#ext(newext = '') ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/microstation/ext/pathname.rb', line 6

def ext(newext = '')
  str = self.to_s
 return self.dup if ['.', '..'].include? str
 if newext != ''
   newext = (newext =~ /^\./) ? newext : ("." + newext)
 end
 Pathname.new(str.dup.sub!(%r(([^/\\])\.[^./\\]*$)) { $1 + newext } || str + newext)
end

#extstr(newext = '') ⇒ Object



15
16
17
# File 'lib/microstation/ext/pathname.rb', line 15

def extstr(newext='')
  Pathname.new( self.to_s.ext(newext))
end

#glob(pattern) ⇒ Object



20
21
22
# File 'lib/microstation/ext/pathname.rb', line 20

def glob(pattern)
  self.class.glob("#{self.to_s}/#{pattern}")
end