class Rankum::Runners::CLIOutputer
Public Class Methods
run(context={})
click to toggle source
# File lib/rankum/runners/cli_outputer.rb, line 9 def self.run context={} CLIOutputer.new(context).run end
Public Instance Methods
run()
click to toggle source
# File lib/rankum/runners/cli_outputer.rb, line 13 def run execute do fail! unless raw_value context.value = round(raw_value) context.output = output end end
Private Instance Methods
output()
click to toggle source
# File lib/rankum/runners/cli_outputer.rb, line 30 def output lines = [] lines << "Rankum" lines << "------------" lines << "Metric: #{context.metric}" color = raw_value > 0.7 ? :green : :red lines << "Similarity: #{Paint["#{context.value} %", color, :bright]}" lines end
raw_value()
click to toggle source
# File lib/rankum/runners/cli_outputer.rb, line 22 def raw_value @raw_value ||= context.value end
round(value)
click to toggle source
# File lib/rankum/runners/cli_outputer.rb, line 26 def round value (value * 100).round(2) end