Class: WPDB::Configuration
- Inherits:
-
Object
- Object
- WPDB::Configuration
- Defined in:
- lib/wpdb_activerecord/configuration.rb
Instance Attribute Summary collapse
-
#post_class ⇒ Object
Returns the value of attribute post_class.
-
#postmeta_class ⇒ Object
Returns the value of attribute postmeta_class.
-
#prefix ⇒ Object
Returns the value of attribute prefix.
-
#term_class ⇒ Object
Returns the value of attribute term_class.
-
#term_relationship_class ⇒ Object
Returns the value of attribute term_relationship_class.
-
#term_taxonomy_class ⇒ Object
Returns the value of attribute term_taxonomy_class.
-
#user_class ⇒ Object
Returns the value of attribute user_class.
-
#usermeta_class ⇒ Object
Returns the value of attribute usermeta_class.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #root ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
16 17 18 19 20 21 22 23 24 25 26 27 |
# 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_" @post_class = config["WPDB_POST_CLASS"] || "WPDB::Post" = 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" = config["WPDB_USERMETA_CLASS"] || "WPDB::Usermeta" end |
Instance Attribute Details
#post_class ⇒ Object
Returns the value of attribute post_class.
12 13 14 |
# File 'lib/wpdb_activerecord/configuration.rb', line 12 def post_class @post_class end |
#postmeta_class ⇒ Object
Returns the value of attribute postmeta_class.
12 13 14 |
# File 'lib/wpdb_activerecord/configuration.rb', line 12 def end |
#prefix ⇒ Object
Returns the value of attribute prefix.
12 13 14 |
# File 'lib/wpdb_activerecord/configuration.rb', line 12 def prefix @prefix end |
#term_class ⇒ Object
Returns the value of attribute term_class.
12 13 14 |
# File 'lib/wpdb_activerecord/configuration.rb', line 12 def term_class @term_class end |
#term_relationship_class ⇒ Object
Returns the value of attribute term_relationship_class.
12 13 14 |
# File 'lib/wpdb_activerecord/configuration.rb', line 12 def term_relationship_class @term_relationship_class end |
#term_taxonomy_class ⇒ Object
Returns the value of attribute term_taxonomy_class.
12 13 14 |
# File 'lib/wpdb_activerecord/configuration.rb', line 12 def term_taxonomy_class @term_taxonomy_class end |
#user_class ⇒ Object
Returns the value of attribute user_class.
12 13 14 |
# File 'lib/wpdb_activerecord/configuration.rb', line 12 def user_class @user_class end |
#usermeta_class ⇒ Object
Returns the value of attribute usermeta_class.
12 13 14 |
# File 'lib/wpdb_activerecord/configuration.rb', line 12 def end |
Instance Method Details
#root ⇒ Object
29 30 31 |
# File 'lib/wpdb_activerecord/configuration.rb', line 29 def root Rails.root || Pathname.new(ENV["RAILS_ROOT"] || Dir.pwd) end |