Class: LiterateRuby::File
- Inherits:
-
File
- Object
- File
- LiterateRuby::File
- Defined in:
- lib/literate-ruby/file.rb
Instance Method Summary collapse
Instance Method Details
#parse ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/literate-ruby/file.rb', line 3 def parse base = File.basename(path, '.*') `touch #{File.basename(path, '.*')}.rb` file = read File.open("#{base}.rb", 'w') do |f| file.each_line do |line| f.write(line[2..-1]) if line[0...2] == '> ' end end "#{base}.rb" end |