Sha256: a1c7e4ed4d06a4173175e21a8c4ea373939aaabbbaf9845f56e4c5d735c93e6a
Contents?: true
Size: 466 Bytes
Versions: 12
Compression:
Stored size: 466 Bytes
Contents
module Bitcoin module Ext module ArrayExt refine Array do # resize array content with +initial_value+. # expect to behave like vec#resize in c++. def resize!(new_size, initial_value = 0) if size < new_size (new_size - size).times{self.<< initial_value} elsif size > new_size (size - new_size).times{delete_at(-1)} end self end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems