Class: TxpAdmin::Config
- Inherits:
-
Object
- Object
- TxpAdmin::Config
- Defined in:
- lib/txp_admin.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
12 13 14 |
# File 'lib/txp_admin.rb', line 12 def initialize @options = self.class.parse_config_file end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
10 11 12 |
# File 'lib/txp_admin.rb', line 10 def @options end |
Class Method Details
.parse_config_file(path = ".") ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/txp_admin.rb', line 16 def self.parse_config_file(path=".") config_file = "#{path}/textpattern/config.php" raise TxpAdmin::ConfigNotFound unless File.exists?(config_file) config = `cat #{config_file}` txpcfg = {} config.gsub!("<?php", "") config.gsub!("?>", "") config.gsub!("$txpcfg", "txpcfg") eval(config) txpcfg.each do |key,value| txpcfg[key.to_sym] = value end # puts txpcfg.inspect return txpcfg end |