Sha256: 79942507d0b1cbb6027b5e53cb36bb293655e77efe6ebfb0e944b129c733cdf3
Contents?: true
Size: 479 Bytes
Versions: 15
Compression:
Stored size: 479 Bytes
Contents
require 'arrayfields' # # the struct class factory method can be used in much the same way as ruby's # own struct generators and is useful when the fields for a set of arrays is # known apriori # c = Array.struct :a, :b, :c # class generator a = c.new [42, nil, nil] a[:c] = 42 p a #=> [42, nil, 42] # # of course we can append too # a[:d] = 42.0 p a[:d] #=> 42.0 p a #=> [42, nil, 42, 42.0]
Version data entries
15 entries across 15 versions & 2 rubygems