Module: Exegesis

Extended by:
Exegesis
Included in:
Exegesis
Defined in:
lib/exegesis.rb,
lib/exegesis/model.rb,
lib/exegesis/design.rb,
lib/exegesis/server.rb,
lib/exegesis/database.rb,
lib/exegesis/document.rb,
lib/exegesis/utils/http.rb

Defined Under Namespace

Modules: Database, Document, Http, Model Classes: Design, Server

Instance Method Summary collapse

Instance Method Details

#instantiate(hash, database = nil) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/exegesis.rb', line 28

def instantiate hash, database=nil
  return nil if hash.nil?
  klass = model_classes[hash['class']]
  obj = klass.nil? ? hash : klass.new(hash)
  obj.database = database if obj.respond_to?(:database=)
  obj
end

#model_classesObject



24
25
26
# File 'lib/exegesis.rb', line 24

def model_classes
  @model_classes ||= {}
end