Sha256: 5830ca1ff088c19935d4507414c1d35dc082a4386b0f272ed0c95ab90c4601bc
Contents?: true
Size: 849 Bytes
Versions: 2
Compression:
Stored size: 849 Bytes
Contents
require_relative "../utils/interactor" require 'paint' module Rankum module Runners class CLIOutputer include Rankum::Utils::Interactor def self.run context={} CLIOutputer.new(context).run end def run execute do fail! unless raw_value context.value = round(raw_value) context.output = output end end private def raw_value @raw_value ||= context.value end def round value (value * 100).round(2) end 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 end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rankum-1.1.0 | lib/rankum/runners/cli_outputer.rb |
rankum-1.0.0 | lib/rankum/runners/cli_outputer.rb |