class Gorillib::Factory::ConvertingFactory
Public Instance Methods
receive(obj)
click to toggle source
# File lib/gorillib/factories.rb, line 136 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/factories.rb, line 149 def convert(obj) obj.dup end