Sha256: 597068d1356d8e24dc51f5bf5b6ab33313f4907fbc542bb03a3b6b22a5cf65e3

Contents?: true

Size: 1.93 KB

Versions: 1

Compression:

Stored size: 1.93 KB

Contents

require 'active_support'
require 'transit/core_ext'

module Transit
  
  autoload :Admin, 'transit/admin'
  autoload :Config, 'transit/config'
  
  module Package
    autoload :Post, 'transit/package/post'
    autoload :Page, 'transit/package/page'
  end
  
  module Model
    autoload :Assets,        'transit/model/assets'
    autoload :Attachments,   'transit/model/attachments'
    autoload :AutoIncrement, 'transit/model/auto_increment'
    autoload :Comments,      'transit/model/comments'
    autoload :Topics,        'transit/model/topics'
    autoload :Base,          'transit/model/base'
    autoload :Hooks,         'transit/model/hooks'
    autoload :Owners,        'transit/model/owners'
    autoload :Paginator,     'transit/model/paginator'
  end
  
  module Controller
    autoload :Generator,  'transit/controller/generator'
    autoload :Responder,  'transit/controller/responder'
  end
  
  module Errors
    autoload :InvalidContext,   'transit/errors/invalid_context'
    autoload :ResourceNotFound, 'transit/errors/resource_not_found'
  end
  
  module Builders
    autoload :JstBuilder,      'transit/builders/jst_builder'
    autoload :FormBuilder,     'transit/builders/form_builder'
    autoload :PackageBuilder,  'transit/builders/package_builder'
  end
    
  DESCRIPTIONS = {}
  
  # Store an array of controller mappings
  mattr_accessor :mappings
  @@mappings = []

  def self.add_mapping(obj)
    @@mappings << obj
  end

  def self.configure(&block)
    yield Transit::Config
  end

  def self.contexts
    ["Text","Video", "Audio"]
  end
  
  def self.track(klass, template)
    DESCRIPTIONS[template] ||= []
    DESCRIPTIONS[template] |= [klass.to_s]
  end
  
  def self.lookup(template)
    DESCRIPTIONS[template] ||= []
  end
  
  def self.superclass_for(template)
    DESCRIPTIONS[template].detect do |klass|
      klass.constantize.superclass === Object
    end
  end
  
end
require 'transit/model/hooks'
require 'transit/rails/engine'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
transit-0.0.2 lib/transit.rb