class GemsBond::Printers::HTML
Prints HTML
file
Private Instance Methods
color(score)
click to toggle source
Returns a color depending on the score value @param score [Float] in [0, 1] @return [String] branding for Bootstrap use
# File lib/gems_bond/printers/html.rb, line 48 def color(score) return "secondary" if score.nil? if score < 0.33 "danger" elsif score < 0.66 "warning" else "success" end end
content()
click to toggle source
Returns the HTML
content @return [String]
# File lib/gems_bond/printers/html.rb, line 31 def content ERB.new(template).result(binding) end
print()
click to toggle source
Prints data into a file @return [void]
# File lib/gems_bond/printers/html.rb, line 17 def print File.open("#{DIRECTORY_PATH}/spy.html", "w") do |file| file.puts content end end
template()
click to toggle source
Returns the ERB template @return [String]
# File lib/gems_bond/printers/html.rb, line 25 def template File.read(File.join(File.dirname(__FILE__), "../../../views/", "diagnosis.erb")) end
version_color(gap)
click to toggle source
Returns a color depending on the gap to last released version @param gap [Integer] @return [String] branding for Bootstrap use
# File lib/gems_bond/printers/html.rb, line 38 def version_color(gap) return "secondary" if gap.nil? return "success" if gap.zero? gap < 3 ? "warning" : "danger" end