Method: String#ext

Defined in:
lib/el4r/el4r-sub.rb

#ext(newext = nil) ⇒ Object

Returns a string which is replaced the filename’s extension with NEWEXT.



613
614
615
616
617
618
619
620
# File 'lib/el4r/el4r-sub.rb', line 613

def ext(newext=nil)
  if newext
    newext[0,1] != '.' and newext="."+newext
    sub(/\.[^\.]+?$/, newext)
  else
    File.extname(self)
  end
end