class Rubycritic::FileGenerator
def analysed_file_name
def analysed_file_name @pathname.basename.sub_ext("").to_s end
def file_directory
def file_directory File.join(REPORT_DIR, File.dirname(@pathname)) end
def file_name
def file_name "#{analysed_file_name}.html" end
def initialize(pathname, smells)
def initialize(pathname, smells) @pathname = pathname @smells = smells end
def render
def render file_code = "" File.readlines(@pathname).each.with_index(LINE_NUMBER_OFFSET) do |line_text, line_number| location = Location.new(@pathname, line_number) line_smells = @smells.select { |smell| smell.located_in?(location) } file_code << LineGenerator.new(line_text, line_smells).render end file_body = FILE_TEMPLATE.result(self.get_binding { file_code }) LAYOUT_TEMPLATE.result(self.get_binding { file_body }) end