lib/fukuzatsu/parsed_file.rb in fukuzatsu-0.9.16 vs lib/fukuzatsu/parsed_file.rb in fukuzatsu-0.10.1
- old
+ new
@@ -2,10 +2,11 @@
include PoroPlus
include Ephemeral::Base
attr_accessor :complexity, :path_to_file, :class_name, :path_to_results
+ attr_accessor :lines_of_code, :source
def class_name
@class_name ||= analyzer.extract_class_name
end
@@ -23,13 +24,26 @@
def methods
@methods ||= analyzer.extract_methods
end
+ def source
+ return @source if @source
+ end_pos = 0
+ self.lines_of_code = []
+ @source = File.readlines(self.path_to_file).each_with_index do |line, index|
+ start_pos = end_pos + 1
+ end_pos += line.size
+ self.lines_of_code << LineOfCode.new(line_number: index + 1, range: (start_pos..end_pos))
+ line
+ end.join
+ end
+
def summary
{
results_file: self.path_to_results,
path_to_file: self.path_to_file,
+ source: source,
class_name: self.class_name,
complexity: complexity
}
end
\ No newline at end of file