Sha256: aba6fb431b1ce63be6bba33db54605d9b8c10a0fe455e8a493978026919077f2
Contents?: true
Size: 456 Bytes
Versions: 3
Compression:
Stored size: 456 Bytes
Contents
# frozen_string_literal: true class Array class HashBuilder attr_accessor :values, :keys def initialize(values, keys) @values = values.dup @keys = keys.dup end def build fixes_sizes Hash[[keys, values].transpose] end private def fixes_sizes values.concat Array.new(keys.size - values.size) if needs_resizing? end def needs_resizing? keys.size > values.size end end end
Version data entries
3 entries across 3 versions & 1 rubygems