Sha256: 9e425aa88b64cd5a19a79c5e29d371d23e32cbaaaa4018d497e2d10af2cefea9
Contents?: true
Size: 963 Bytes
Versions: 1
Compression:
Stored size: 963 Bytes
Contents
class String # okay this is a bit much --we should subclass string. # but it will do for now and we will work this out # when CLIO is up and running. attr_accessor :color # Find actual filename (casefolding) and returns it. # Returns nil if no file is found. def to_actual_filename Dir.glob(self, File::FNM_CASEFOLD).first end # Find actual filename (casefolding) and replace string with it. # If file not found, string remains the same and method returns nil. def to_actual_filename! filename = to_actual_filename replace(filename) if filename end # def unfold_paragraphs blank = false text = '' split(/\n/).each do |line| if /\S/ !~ line text << "\n\n" blank = true else if /^(\s+|[*])/ =~ line text << (line.rstrip + "\n") else text << (line.rstrip + " ") end blank = false end end return text end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ratch-1.0.0 | lib/ratch/core_ext/string.rb |