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 #=> 0
# File lib/arrayfields.rb, line 397 def [](*pairs) pairs.flatten! raise ArgumentError, "argument must be key/val pairs" unless (pairs.size % 2 == 0) fields, elements = [], [] while((f = pairs.shift) and (e = pairs.shift)) fields << f and elements << e end new fields, elements end
Generated with the Darkfish Rdoc Generator 2.