proxy class that allows an array to be wrapped in a way that still allows # keyword access. also facilitate usage of ArrayFields with arraylike objects. thnx to Sean O’Dell for the suggestion.
sample usage
fa = FieldedArray.new %w(zero one two), [0,1,2] p fa[‘zero’] #=> 0
# File lib/arrayfields.rb, line 388
388: def [](*pairs)
389: pairs.flatten!
390: raise ArgumentError, "argument must be key/val pairs" unless
391: (pairs.size % 2 == 0)
392: fields, elements = [], []
393: while((f = pairs.shift) and (e = pairs.shift))
394: fields << f and elements << e
395: end
396: new fields, elements
397: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.