Class: Mow::Trimmer
- Inherits:
-
Object
- Object
- Mow::Trimmer
- Defined in:
- lib/mow.rb
Instance Method Summary collapse
Instance Method Details
#trim(from_file_path, to_file_path = nil) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/mow.rb', line 5 def trim(from_file_path, to_file_path=nil) results = File.read(from_file_path).split("\n").delete_if { |line| line =~ /^\s*#/ }.compact.join(";") if to_file_path File.open(to_file_path, "w+") { |f| f.puts(results) } else print results end end |