multiton cache of fields - wraps fields and fieldpos map to save memory
# File lib/arrayfields.rb, line 18
18: def init_sets
19: @sets = {}
20: end
# File lib/arrayfields.rb, line 15
15: def new fields
16: @sets[fields] ||= super
17: end
# File lib/arrayfields.rb, line 27
27: def initialize fields
28: raise ArgumentError, "<#{ fields.inspect }> not inject-able" unless
29: fields.respond_to? :inject
30:
31: @fieldpos =
32: fields.inject({}) do |h, f|
33: unless String === f or Symbol === f
34: raise ArgumentError, "<#{ f.inspect }> neither String nor Symbol"
35: end
36: h[f] = h.size
37: h
38: end
39:
40: @fields = fields
41: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.