class XP5K::Config
Public Class Methods
[](opt)
click to toggle source
Configuration options getter
# File lib/xp5k/config.rb, line 27 def self.[](opt) @@config[opt.to_sym] end
[]=(opt, value)
click to toggle source
Configuration options setter
# File lib/xp5k/config.rb, line 32 def self.[]=(opt, value) @@config[opt.to_sym] = value end
load(options = {})
click to toggle source
Load the experiment configuration file
# File lib/xp5k/config.rb, line 13 def self.load(options = {}) path = options[:path] || 'xp.conf' if File.exist?(File.expand_path(File.join(Dir.pwd, path))) file_path = File.expand_path(File.join(Dir.pwd, path)) self.instance_eval(IO.read(file_path),file_path, 1) @@config[:loaded] = true end end
loaded?()
click to toggle source
# File lib/xp5k/config.rb, line 22 def self.loaded? @@config[:loaded] end
method_missing(method_symbol, *args)
click to toggle source
Using methods in configuration file and transform into hash keys
# File lib/xp5k/config.rb, line 37 def self.method_missing(method_symbol, *args) @@config[method_symbol] = args[0] @@config[method_symbol] end