Parent

Namespace

RBatch::RunConf

Attributes

run_conf_path[R]
home_dir[R]

Public Class Methods

new(run_conf_path,home_dir) click to toggle source
    # File lib/rbatch/run_conf.rb, line 28
28:     def initialize(run_conf_path,home_dir)
29:       @run_conf_path = run_conf_path
30:       @home_dir = home_dir
31:       reset
32:       load
33:     end

Public Instance Methods

[](key) click to toggle source
    # File lib/rbatch/run_conf.rb, line 92
92:     def[](key)
93:       if @opt[key].nil?
94:         raise RBatch::RunConf::Exception, "Value of key=\"#{key}\" is nil"
95:       end
96:       @opt[key]
97:     end
[]=(key,value) click to toggle source
     # File lib/rbatch/run_conf.rb, line 99
 99:     def[]=(key,value)
100:       if ! @opt.has_key?(key)
101:         raise RBatch::RunConf::Exception, "Key=\"#{key}\" does not exist"
102:       end
103:       @opt[key]=value
104:     end
load() click to toggle source
    # File lib/rbatch/run_conf.rb, line 47
47:     def load()
48:       begin
49:         @yaml = YAML::load_file(@run_conf_path)
50:       rescue
51:         # when run_conf does not exist, do nothing.
52:         @yaml = false
53:       end
54:       if @yaml
55:         @yaml.each_key do |key|
56:           if @@def_opt.has_key?(key.to_sym)
57:             @opt[key.to_sym]=@yaml[key]
58:           else
59:             raise RBatch::RunConf::Exception, "\"#{key}\" is not available option"
60:           end
61:         end
62:       end
63:     end
merge(opt) click to toggle source
    # File lib/rbatch/run_conf.rb, line 80
80:     def merge(opt)
81:       tmp = @opt.clone
82:       opt.each_key do |key|
83:         if tmp.has_key?(key)
84:           tmp[key] = opt[key]
85:         else
86:           raise RBatch::RunConf::Exception, "\"#{key}\" is not available option"
87:         end
88:       end
89:       return tmp
90:     end
merge!(opt) click to toggle source
    # File lib/rbatch/run_conf.rb, line 70
70:     def merge!(opt)
71:       opt.each_key do |key|
72:         if @opt.has_key?(key)
73:           @opt[key] = opt[key]
74:         else
75:           raise RBatch::RunConf::Exception, "\"#{key}\" is not available option"
76:         end
77:       end
78:     end
reload() click to toggle source
    # File lib/rbatch/run_conf.rb, line 65
65:     def reload()
66:       reset
67:       load
68:     end
reset() click to toggle source
    # File lib/rbatch/run_conf.rb, line 35
35:     def reset()
36:       @opt = @@def_opt.clone
37:       case RUBY_PLATFORM
38:       when /mswin|mingw/
39:         @opt[:log_hostname] =  ENV["COMPUTERNAME"] ? ENV["COMPUTERNAME"] : "unknownhost"
40:       when /cygwin|linux/
41:         @opt[:log_hostname] = ENV["HOSTNAME"] ? ENV["HOSTNAME"] : "unknownhost"
42:       else
43:         @opt[:log_hostname] = "unknownhost"
44:       end
45:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.