Class: Skunk::Generator::Html::SkunkData

Inherits:
Object
  • Object
show all
Defined in:
lib/skunk/generators/html/skunk_data.rb

Overview

Data object for the HTML overview report

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(analysed_modules) ⇒ SkunkData

Returns a new instance of SkunkData.



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/skunk/generators/html/skunk_data.rb', line 15

def initialize(analysed_modules)
  @analysed_modules = analysed_modules
  @generated_at = Time.now.strftime("%Y-%m-%d %H:%M:%S")
  @skunk_version = Skunk::VERSION

  @analysed_modules_count = non_test_modules.count
  @skunk_score_total = non_test_modules.sum(&:skunk_score)
  @skunk_score_average = calculate_average
  @worst_pathname = PathTruncator.truncate(find_worst_module&.pathname)
  @worst_score = find_worst_module&.skunk_score
  @files = build_files
end

Instance Attribute Details

#analysed_modules_countObject (readonly)

Returns the value of attribute analysed_modules_count.



11
12
13
# File 'lib/skunk/generators/html/skunk_data.rb', line 11

def analysed_modules_count
  @analysed_modules_count
end

#filesObject (readonly)

Returns the value of attribute files.



11
12
13
# File 'lib/skunk/generators/html/skunk_data.rb', line 11

def files
  @files
end

#generated_atObject (readonly)

Returns the value of attribute generated_at.



11
12
13
# File 'lib/skunk/generators/html/skunk_data.rb', line 11

def generated_at
  @generated_at
end

#skunk_score_averageObject (readonly)

Returns the value of attribute skunk_score_average.



11
12
13
# File 'lib/skunk/generators/html/skunk_data.rb', line 11

def skunk_score_average
  @skunk_score_average
end

#skunk_score_totalObject (readonly)

Returns the value of attribute skunk_score_total.



11
12
13
# File 'lib/skunk/generators/html/skunk_data.rb', line 11

def skunk_score_total
  @skunk_score_total
end

#skunk_versionObject (readonly)

Returns the value of attribute skunk_version.



11
12
13
# File 'lib/skunk/generators/html/skunk_data.rb', line 11

def skunk_version
  @skunk_version
end

#worst_pathnameObject (readonly)

Returns the value of attribute worst_pathname.



11
12
13
# File 'lib/skunk/generators/html/skunk_data.rb', line 11

def worst_pathname
  @worst_pathname
end

#worst_scoreObject (readonly)

Returns the value of attribute worst_score.



11
12
13
# File 'lib/skunk/generators/html/skunk_data.rb', line 11

def worst_score
  @worst_score
end