class Gorillib::Factory::HashFactory
Attributes
keys_factory[R]
receive
-
factory for converting keys
Public Class Methods
new(options={})
click to toggle source
Calls superclass method
Gorillib::Factory::EnumerableFactory::new
# File lib/gorillib/factories.rb, line 518 def initialize(options={}) @keys_factory = Gorillib::Factory( options.delete(:keys){ Gorillib::Factory(:identical) } ) super(options) end
Public Instance Methods
convert(obj)
click to toggle source
# File lib/gorillib/factories.rb, line 523 def convert(obj) hsh = empty_product obj.each_pair do |key, val| hsh[keys_factory.receive(key)] = items_factory.receive(val) end hsh end