Sha256: 952e8c8af97670a1403a4f12aa6ff8bff5d92fb7df68a63ce2f2f2898feef383

Contents?: true

Size: 465 Bytes

Versions: 1

Compression:

Stored size: 465 Bytes

Contents

require 'terminal-table'

module SonicPass
  class CLI

    def initialize(pwds)
      @pwds = pwds
    end

    def self.call(*args, &block)
      new(*args, &block).print
    end

    def print
      rows = @pwds.each_with_index.map { |value, index| [index.next, value] }

      table = Terminal::Table.new :title => "Passwords generated", :rows => rows
      table.align_column(1, :center)
      table.align_column(2, :center)

      puts table
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sonic_pass-1.0.1 cli_ext/base.rb