Sha256: 4f34553fd89795939315970dcbcec03577d55c84c81410e7226585531a1ff003
Contents?: true
Size: 726 Bytes
Versions: 60
Compression:
Stored size: 726 Bytes
Contents
require 'table_print' module PactBroker module Client class Versions class TextFormatter Line = Struct.new(:number, :tags) OPTIONS = [ { number: {:width => 40} }, { tags: {} } ] def self.call(version_hash) tags = (lookup(version_hash, [], :_embedded, :tags) || []).collect{ | t| t[:name] }.join(" ") data = Line.new(version_hash[:number], tags) printer = TablePrint::Printer.new([data], OPTIONS) printer.table_print end def self.lookup line, default, *keys keys.reduce(line) { | line, key | line[key] } rescue NoMethodError default end end end end end
Version data entries
60 entries across 60 versions & 1 rubygems