Class: File

Inherits:
Object show all
Extended by:
Grep, Lock, Write
Defined in:
lib/vex/base/filesystem/parse_filename.rb

Defined Under Namespace

Modules: Etest, Grep, Lock, Write

Class Method Summary collapse

Methods included from Write

touch, write

Methods included from Lock

locked

Methods included from Grep

grep

Class Method Details

.basename_wo_ext(s) ⇒ Object



2
3
4
5
6
7
8
9
# File 'lib/vex/base/filesystem/parse_filename.rb', line 2

def self.basename_wo_ext(s)
  bn = File.basename(s)
  if bn =~ /^(.*)\.([^.]*)$/
    $1
  else
    bn
  end
end

.extname_wo_dot(s) ⇒ Object

File.extname_wo_dot(“x.y”) => “y” File.extname_wo_dot(“x.”) => “” File.extname_wo_dot(“.y”) => “” File.extname_wo_dot(“x”) => “”



17
18
19
# File 'lib/vex/base/filesystem/parse_filename.rb', line 17

def self.extname_wo_dot(s)
  File.extname(s) =~ /^\.([^.]*)$/ ? $1 : ""
end