Module: Impresser

Defined in:
lib/impresser.rb,
lib/impresser/version.rb,
lib/impresser/exceptions.rb,
lib/impresser/active_record.rb,
lib/impresser/active_record/link.rb,
lib/impresser/active_record/page.rb,
lib/impresser/active_record/post.rb,
lib/impresser/active_record/term.rb,
lib/impresser/active_record/user.rb,
lib/impresser/mixin/authenticate.rb,
lib/impresser/active_record/option.rb,
lib/impresser/active_record/comment.rb,
lib/impresser/active_record/post_base.rb,
lib/impresser/active_record/post_meta.rb,
lib/impresser/active_record/user_meta.rb,
lib/impresser/active_record/attachment.rb,
lib/impresser/active_record/comment_meta.rb,
lib/impresser/mixin/serialization_helper.rb,
lib/impresser/active_record/term_taxonomy.rb,
lib/impresser/active_record/term_relationship.rb

Defined Under Namespace

Modules: ActiveRecord, Authenticate, SerializationHelper Classes: NoOrmError

Constant Summary collapse

MODEL_NAMES =
%w(post_base attachment comment comment_meta link option post page post_meta term term_relationship term_taxonomy user user_meta).freeze
Config =
{
  :table_name_prefix => "wp_",
  :connect => Hash.new
}
VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.load_models_for(orm) ⇒ Object

Loads data models for the specified ORM

Parameters:

  • orm (String)

    The ORM for which you want to load models



21
22
23
# File 'lib/impresser.rb', line 21

def self.load_models_for(orm)
  MODEL_NAMES.each{ |model| require File.join("impresser", orm.to_s, model) }
end

.setup(orm = :active_record, options = {}) ⇒ Object



12
13
14
15
16
# File 'lib/impresser.rb', line 12

def self.setup(orm=:active_record, options={})
  Config.merge!(options)
  require "impresser/#{orm}"
  self.load_models_for(orm)
end