class Realize::File::Basename
Takes the value and strips out the directory. Suffix is provided as an option which strips out the extension (last period and beyond). If '.*' is passed in as the suffix then any extension will be stripped. Note that files with multiple extensions will only have their last extesion removed.
Attributes
suffix[R]
Public Class Methods
new(suffix: '')
click to toggle source
# File lib/realize/file/basename.rb, line 21 def initialize(suffix: '') @suffix = suffix.to_s freeze end
Public Instance Methods
transform(_resolver, value, _time, _record)
click to toggle source
# File lib/realize/file/basename.rb, line 27 def transform(_resolver, value, _time, _record) ::File.basename(value.to_s, suffix) end