class Gorillib::Factory::HashFactory

Attributes

keys_factory[R]
receive

factory for converting keys

Public Class Methods

new(options={}) click to toggle source
# File lib/gorillib/model/factories.rb, line 510
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/model/factories.rb, line 515
def convert(obj)
  hsh = empty_product
  obj.each_pair do |key, val|
    hsh[keys_factory.receive(key)] = items_factory.receive(val)
  end
  hsh
end