Parent
Information
Class Index
![show/hide quicksearch [+]](./assets/icon/find.png)
- Ratch
- Ratch::Batch
- Ratch::CLI
- Ratch::ConfigUtils
- Ratch::Console
- Ratch::EmailUtils
- Ratch::Emailer
- Ratch::FTPUtils
- Ratch::FileList
- Ratch::FileNotFound
- Ratch::Help
- Ratch::POMUtils
- Ratch::RDocUtils
- Ratch::Script
- Ratch::Shell
- Ratch::System
- Ratch::TarUtils
- Ratch::XDGUtils
- Ratch::ZlibUtils
- FileTest
- Hash
- NilClass
- Object
- String
String
TODO: Replace with facets/string/unfold
Public Instance Methods
to_actual_filename()
click to toggle source
Find actual filename (casefolding) and returns it. Returns nil if no file is found.
# File lib/ratch/core_ext/to_actual_filename.rb, line 6 6: def to_actual_filename 7: Dir.glob(self, File::FNM_CASEFOLD).first 8: end
to_actual_filename!()
click to toggle source
Find actual filename (casefolding) and replace string with it. If file not found, string remains the same and method returns nil.
# File lib/ratch/core_ext/to_actual_filename.rb, line 13
13: def to_actual_filename!
14: filename = to_actual_filename
15: replace(filename) if filename
16: end
to_list()
click to toggle source
Helper method for cleaning list options. This will split the option on ’:’ or ’;’ if it is a string, rather than an array. And it will make sure there are no nil elements.
# File lib/ratch/core_ext/to_list.rb, line 24
24: def to_list
25: split(/[:;,\n]/)
26: end
unfold_paragraphs()
click to toggle source
# File lib/ratch/core_ext/unfold_paragraphs.rb, line 6
6: def unfold_paragraphs
7: blank = false
8: text = ''
9: split(/\n/).each do |line|
10: if /\S/ !~ line
11: text << "\n\n"
12: blank = true
13: else
14: if /^(\s+|[*])/ =~ line
15: text << (line.rstrip + "\n")
16: else
17: text << (line.rstrip + " ")
18: end
19: blank = false
20: end
21: end
22: text = text.gsub("\n\n\n","\n\n")
23: return text
24: end
Disabled; run with --debug to generate this.