Sha256: f53fd17930638f6e8bb57dd5c7dccb237c49c5129664a5df12a82f92297b4bad
Contents?: true
Size: 457 Bytes
Versions: 1
Compression:
Stored size: 457 Bytes
Contents
require 'pathname' unless Pathname.instance_methods.any?{|m| m.to_s=='sub_ext'} class Pathname # This method is available in Ruby >= 1.9.1 def sub_ext(new_ext) # this is how I would do it: # new_ext = ".#{new_ext}" unless new_ext[0,1]=='.' # Pathname.new to_s[/.*(?=\..+$)/]+new_ext # but we'll try to be compatible with the standars library method Pathname(self.to_s.chomp(extname) + new_ext) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
modalsupport-0.9.2 | lib/modalsupport/pathname.rb |