class Gorillib::Factory::ConvertingFactory

Public Instance Methods

receive(obj) click to toggle source
# File lib/gorillib/model/factories.rb, line 128
def receive(obj)
  return nil  if blankish?(obj)
  return obj  if native?(obj)
  convert(obj)
rescue NoMethodError, TypeError, RangeError, ArgumentError => err
  mismatched!(obj, err.message, err.backtrace)
end

Protected Instance Methods

convert(obj) click to toggle source

Convert a receivable object to the factory’s product type. This method should convert an object to ‘native?` form or die trying; any variant types (eg nil for an empty string) are handled elsewhere by `receive`.

@param [Object] obj the object to convert.

# File lib/gorillib/model/factories.rb, line 141
def convert(obj)
  obj.dup
end