Class: WordPress
- Inherits:
-
Object
- Object
- WordPress
- Defined in:
- lib/wordpress.rb,
lib/wordpress/version.rb
Defined Under Namespace
Modules: Version Classes: Base, Options
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(options) ⇒ WordPress
constructor
A new instance of WordPress.
Constructor Details
#initialize(options) ⇒ WordPress
Returns a new instance of WordPress.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/wordpress.rb', line 8 def initialize() # Symbolize keys = .inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo} [:wordpress_prefix] ||= 'wp_' @tbl = { terms: [:wordpress_prefix] + 'terms', termtax: [:wordpress_prefix] + 'term_taxonomy', termrel: [:wordpress_prefix] + 'term_relationships', posts: [:wordpress_prefix] + 'posts', postmeta: [:wordpress_prefix] + 'postmeta', options: [:wordpress_prefix] + 'options', prefix: [:wordpress_prefix] } @conn = Mysql2::Client.new @conn..merge!(symbolize_keys: true) # The WordPress options table @options = WP::Options.new @conn, @tbl end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
30 31 32 |
# File 'lib/wordpress.rb', line 30 def @options end |