Sha256: c7b0466daca6c89a2cc8f2e9706d1ea0910ba9dd9958331b4a9ce6a4508bae1a
Contents?: true
Size: 891 Bytes
Versions: 13
Compression:
Stored size: 891 Bytes
Contents
# frozen_string_literal: true module Cmdlet # String manipulation module Str # Padr: take the value and give it padding on the right hand side class Padr < Cmdlet::BaseCmdlet # # @param [String|Symbol|Int] value - value to apply padding to # @param [Int] count - how much padding to apply. defaults to configuration.padr_count # @param [String] char - character to pad with. defaults to configuration.padr_char # @return [String] the value padded on RHS with [char (default ' ')] and [count (default 30)] def call(value, count = nil, char = nil) value = '' if value.nil? count = KConfig.configuration.cmdlet.padr_count if count.nil? count = count.to_i if count.is_a?(String) char = KConfig.configuration.cmdlet.padr_char if char.nil? value.to_s.ljust(count, char) end end end end
Version data entries
13 entries across 13 versions & 1 rubygems