Sha256: e2e19aa65ae0720f4c1a343cda49bf034838a5ed4b201c187d8f6db0cb8d50e2
Contents?: true
Size: 970 Bytes
Versions: 23
Compression:
Stored size: 970 Bytes
Contents
# frozen_string_literal: true module ConvenientService module Utils module Array class Rjust < Support::Command ## # @!attribute [r] array # @return [Array] # attr_reader :array ## # @!attribute [r] size # @return [Integer] # attr_reader :size ## # @!attribute [r] pad # @return [Object] Can be any type. # attr_reader :pad ## # @param array [Array] # @param size [Integer] # @param pad [Object] Can be any type. # @return [void] # def initialize(array, size, pad = nil) @array = array @size = size @pad = pad end ## # @return [Array] # def call return array if size <= array.size count = size - array.size array + [pad] * count end end end end end
Version data entries
23 entries across 23 versions & 1 rubygems