Class: Gorillib::Factory::ConvertingFactory

Inherits:
BaseFactory
  • Object
show all
Defined in:
lib/gorillib/model/factories.rb

Instance Method Summary collapse

Methods inherited from BaseFactory

blankish?, #blankish?, #initialize, #native?, native?, typename, #typename

Constructor Details

This class inherits a constructor from Gorillib::Factory::BaseFactory

Instance Method Details

#receive(obj) ⇒ Object



128
129
130
131
132
133
134
# 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