Class: WPDB::Config::AutoFormat
- Inherits:
-
Object
- Object
- WPDB::Config::AutoFormat
- Defined in:
- lib/ruby-wpdb/config.rb
Instance Attribute Summary collapse
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
Instance Method Summary collapse
- #config ⇒ Object
- #format ⇒ Object
-
#initialize(filename) ⇒ AutoFormat
constructor
A new instance of AutoFormat.
Constructor Details
#initialize(filename) ⇒ AutoFormat
Returns a new instance of AutoFormat.
69 70 71 |
# File 'lib/ruby-wpdb/config.rb', line 69 def initialize(filename) @filename = Pathname(filename) end |
Instance Attribute Details
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
67 68 69 |
# File 'lib/ruby-wpdb/config.rb', line 67 def filename @filename end |
Instance Method Details
#config ⇒ Object
84 85 86 |
# File 'lib/ruby-wpdb/config.rb', line 84 def config format.new(filename).config end |
#format ⇒ Object
73 74 75 76 77 78 79 80 81 82 |
# File 'lib/ruby-wpdb/config.rb', line 73 def format case filename.extname when ".yml", ".yaml" Config::YAML when ".php" Config::WPConfig else nil end end |