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.
64 65 66 |
# File 'lib/txp_admin.rb', line 64 def initialize @options = self.class.parse_config_file end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
62 63 64 |
# File 'lib/txp_admin.rb', line 62 def @options end |
Class Method Details
.parse_config_file(path = ".") ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/txp_admin.rb', line 68 def self.parse_config_file(path=".") config_file = "#{path}/textpattern/config.php" raise TxpAdmin::ConfigNotFound unless File.exists?(config_file) config_lines = File.readlines(config_file) config_to_eval = String.new config_lines.each do |line| config_to_eval << line if (line.include? "$txpcfg" and !line.include? "define") end config_to_eval.gsub!("$txpcfg", "txpcfg") txpcfg = {} eval(config_to_eval) txpcfg.each do |key,value| txpcfg[key.to_sym] = value end # puts txpcfg.inspect return txpcfg end |