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.
66 67 68 |
# File 'lib/ruby-wpdb/config.rb', line 66 def initialize(filename) @filename = Pathname(filename) end |
Instance Attribute Details
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
64 65 66 |
# File 'lib/ruby-wpdb/config.rb', line 64 def filename @filename end |
Instance Method Details
#config ⇒ Object
81 82 83 |
# File 'lib/ruby-wpdb/config.rb', line 81 def config format.new(filename).config end |
#format ⇒ Object
70 71 72 73 74 75 76 77 78 79 |
# File 'lib/ruby-wpdb/config.rb', line 70 def format case filename.extname when ".yml", ".yaml" Config::YAML when ".php" Config::WPConfig else nil end end |