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/model/factories.rb, line 204 def self.receive(obj) allocate.receive(obj) end
Public Instance Methods
blankish?(obj)
click to toggle source
# File lib/gorillib/model/factories.rb, line 196 def blankish?(obj) obj.nil? ; end
native?(obj)
click to toggle source
# File lib/gorillib/model/factories.rb, line 197 def native?(obj) false ; end
receive(attrs, &block)
click to toggle source
# File lib/gorillib/model/factories.rb, line 198 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