Sha256: a2e16ca7653cbf1fe0ba66ee5ea0fccea5c9cefbd9e62170d84e7562e548d82f
Contents?: true
Size: 1.29 KB
Versions: 3
Compression:
Stored size: 1.29 KB
Contents
require 'pathname' class Hash def to_symbolized_hash new_hash= {} self.each {|k,v| new_hash[k.to_sym]= v } new_hash end def to_hash_object Gumdrop::Util::HashObject.from self end def ends_with?(string) self[0..(string.length)] == string end def starts_with?(string) self[0..(string.length)] == string end end class String def / (other) File.join self, other end def relative dup.relative! end def relative! sub! /^[\/]/, '' self end def expand_path(relative_to=nil) if (Pathname.new self).absolute? self elsif relative_to.nil? File.expand_path self else File.expand_path relative_to / self end end def path_match?(pattern) File.fnmatch pattern, self, File::FNM_PATHNAME | File::FNM_DOTMATCH | File::FNM_CASEFOLD end # alias_method :starts_with?, :start_with? # alias_method :ends_with?, :end_with? end # module PathTools # def / (other) # self.join other.to_s # end # def - (other) # Pathname.new self.to_s.gsub(other, '') # end # def match?(other) # fnmatch? pattern, File::FNM_PATHNAME | File::FNM_DOTMATCH | File::FNM_CASEFOLD # end # end # class Pathname # include PathTools # end # class String # def to_pathname # Pathname.new self # end # end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
gumdrop-1.0.2 | lib/gumdrop/util/core_ex.rb |
gumdrop-1.0.1 | lib/gumdrop/util/core_ex.rb |
gumdrop-1.0.0 | lib/gumdrop/util/core_ex.rb |