Sha256: 5ee40ded0bf9b00c26ca3097b9bd43f50a7d04f61dc42a2d1c2397d6107ebaf4
Contents?: true
Size: 536 Bytes
Versions: 76
Compression:
Stored size: 536 Bytes
Contents
module Dragonfly # Convenience methods for setting basename and extension # Including class needs to define a 'name' accessor # which is assumed to hold a filename-style string module HasFilename def basename File.basename(name, '.*') if name end def basename=(basename) self.name = [basename, ext].compact.join('.') end def ext File.extname(name)[/\.(.*)/, 1] if name end def ext=(ext) self.name = [(basename || 'file'), ext].join('.') end end end
Version data entries
76 entries across 76 versions & 2 rubygems