Sha256: 8e80b3583de893bc094d130c298d21cb5281dbe054d08eaabc9a1eb6a648781f

Contents?: true

Size: 879 Bytes

Versions: 1

Compression:

Stored size: 879 Bytes

Contents

require 'time'
require 'pathname'
require 'restclient'
require 'json'

$:.unshift File.dirname(__FILE__) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))

require 'monkeypatches/time'

module Exegesis
  autoload :Http,         'exegesis/utils/http'

  autoload :Server,       'exegesis/server'
  autoload :Database,     'exegesis/database'

  autoload :Model,        'exegesis/model'
  autoload :Document,     'exegesis/document'
  
  autoload :Designs,      'exegesis/designs'
  autoload :Design,       'exegesis/design'
  
  extend self
  
  def model_classes
    @model_classes ||= {}
  end
  
  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
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mattly-exegesis-0.2.0 lib/exegesis.rb