Class: Pathname

Inherits:
Object
  • Object
show all
Defined in:
lib/duvet/core_ext.rb

Instance Method Summary collapse

Instance Method Details

#extensionString

Gets just the extension of the pathname

Returns:

  • (String)

    the extension of the path, without the ‘.’



6
7
8
# File 'lib/duvet/core_ext.rb', line 6

def extension
  self.extname[1..-1]
end

#file_nameString

Gets the name of the file without the extension

Returns:

  • (String)

    name of the file



13
14
15
# File 'lib/duvet/core_ext.rb', line 13

def file_name
  self.basename.to_s[0...-(self.extension.size+1)]
end