class Gorillib::Factory::EnumerableFactory

Attributes

items_factory[R]
receive

factory for converting items

Public Class Methods

new(options={}) click to toggle source
Calls superclass method Gorillib::Factory::BaseFactory::new
# File lib/gorillib/model/factories.rb, line 478
def initialize(options={})
  @items_factory = Gorillib::Factory( options.delete(:items){ :identical } )
  redefine(:empty_product, options.delete(:empty_product)) if options.has_key?(:empty_product)
  super(options)
end

Public Instance Methods

blankish?(obj) click to toggle source
# File lib/gorillib/model/factories.rb, line 484
def blankish?(obj)    obj.nil? ; end
convert(obj) click to toggle source
# File lib/gorillib/model/factories.rb, line 491
def convert(obj)
  clxn = empty_product
  obj.each do |val|
    clxn << items_factory.receive(val)
  end
  clxn
end
empty_product() click to toggle source
# File lib/gorillib/model/factories.rb, line 487
def empty_product
  @product.new
end
native?(obj) click to toggle source
# File lib/gorillib/model/factories.rb, line 485
def native?(obj)      false    ; end