Parent

Included Modules

FieldedArray

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

Public Class Methods

[](*pairs) click to toggle source
     # 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
new(fields = [], array = []) click to toggle source
     # File lib/arrayfields.rb, line 399
399:     def initialize fields = [], array = []
400:       @a = array
401:       self.fields = fields
402:     end

Public Instance Methods

method_missing(meth, *args, &block) click to toggle source
     # File lib/arrayfields.rb, line 403
403:     def method_missing(meth, *args, &block)
404:       @a.send(meth, *args, &block)
405:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.