class GenericModel

Manufactures objects from their raw attributes hash

The hash must have a value for ‘:_type`, used to retrieve the actual factory

Public Class Methods

receive(obj) click to toggle source
# File lib/gorillib/factories.rb, line 212
def self.receive(obj) allocate.receive(obj) end

Public Instance Methods

blankish?(obj) click to toggle source
# File lib/gorillib/factories.rb, line 204
def blankish?(obj) obj.nil? ; end
native?(obj) click to toggle source
# File lib/gorillib/factories.rb, line 205
def native?(obj)   false  ; end
receive(attrs, &block) click to toggle source
# File lib/gorillib/factories.rb, line 206
def receive(attrs, &block)
  Gorillib::Model::Validate.hashlike!(attrs){ "attributes for typed object" }
  klass = Gorillib::Factory(attrs.fetch(:_type){ attrs.fetch("_type") })
  #
  klass.new(attrs, &block)
end