lib/ruumba/analyzer.rb
# Extracts Ruby code from an ERB template.
# @param [String] filename The filename.
# @return [String] The extracted Ruby code.
Extracts Ruby code from an ERB template.
Extracts Ruby code from an ERB template .
def extract(filename)
      file_text, matches = parse_file(filename)
      extracted_ruby = ''
      last_match = [0, 0]
      matches.each do |start_index, end_index|
        handled_region_before(start_index, last_match.last, file_text, extracted_ruby)
        extracted_ruby << extract_match(file_text, start_index, end_index)
        last_match = [start_index, end_index]
      end
      extracted_ruby << file_text[last_match.last..-1].gsub(/./, ' ')
    end
def extract ( filename ) file_text , matches = parse_file ( filename ) extracted_ruby = '' last_match = [ 0 , 0 ] matches . each do | start_index , end_index | handled_region_before ( start_index , last_match . last , file_text , extracted_ruby ) extracted_ruby << extract_match ( file_text , start_index , end_index ) last_match = [ start_index , end_index ] end extracted_ruby << file_text [ last_match . last .. - 1 ] . gsub ( / . / , ' ' ) end
Extracts Ruby code from an ERB template.
Extracts Ruby code from an ERB template .
The extracted Ruby code.
The extracted Ruby code .
String
filename
<not_specific>
<not_specific>
filename The filename.
filename The filename .