class WPDB::Configuration

Attributes

comment_class[RW]
option_class[RW]
post_class[RW]
postmeta_class[RW]
prefix[RW]
term_class[RW]
term_relationship_class[RW]
term_taxonomy_class[RW]
user_class[RW]
usermeta_class[RW]

Public Class Methods

new() click to toggle source
# File lib/wpdb_activerecord/configuration.rb, line 16
def initialize
  path = File.join(root, "config", "wpdb_config.yml")
  config = File.exists?(path) ? YAML.load_file(path) : Hash.new
  @prefix = config["WPDB_PREFIX"] || "wp_"
  @option_class = config["WPDB_OPTION_CLASS"] || "WPDB::Option"
  @comment_class = config["WPDB_COMMENT_CLASS"] || "WPDB::Comment"
  @post_class = config["WPDB_POST_CLASS"] || "WPDB::Post"
  @postmeta_class = config["WPDB_POSTMETA_CLASS"] || "WPDB::Postmeta"
  @term_class = config["WPDB_TERM_CLASS"] || "WPDB::Term"
  @term_relationship_class = config["WPDB_TERM_RELATIONSHIP_CLASS"] || "WPDB::TermRelationship"
  @term_taxonomy_class = config["WPDB_TERM_TAXONOMY_CLASS"] || "WPDB::TermTaxonomy"
  @user_class = config["WPDB_USER_CLASS"] || "WPDB::User"
  @usermeta_class = config["WPDB_USERMETA_CLASS"] || "WPDB::Usermeta"
end

Public Instance Methods

root() click to toggle source
# File lib/wpdb_activerecord/configuration.rb, line 31
def root
  Rails.root || Pathname.new(ENV["RAILS_ROOT"] || Dir.pwd)
end