Class: ErbTagsRemover
- Inherits:
-
Object
- Object
- ErbTagsRemover
- Defined in:
- lib/ErbFileAnalyser/Erb_tags_remover.rb
Overview
Remove tags from erb file and output only an array of pure ruby code
Instance Method Summary collapse
Instance Method Details
#remove_erb_tags(text) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/ErbFileAnalyser/Erb_tags_remover.rb', line 5 def (text) all_tagged_chunks = text.scan(/(?<=\<%)(.*?)(?=\%>)/) all_tagged_chunks.each do |tagged_chunks| tagged_chunks.each do |tagged_chunk| if tagged_chunk[0] == '=' tagged_chunk.slice!(0) end if tagged_chunk[-1] == '-' tagged_chunk.slice!(-1) end if tagged_chunk[0] == '#' tagged_chunks - [tagged_chunk] end end end all_tagged_chunks.join("\n") end |