module Dyndoc::DynConfig
# used for Docker mode
module Docker
## TO TEST: @@task_file = "/Users/remy/DOCKER_TASK_FILE" @@task_file = "/dyndoc-proj/.cache/task_latex_file" @@tasks=nil def Docker.init_task_file FileUtils.rm_f(@@task_file) @@tasks=[] end def Docker.add_task(task) @@tasks << task end def Docker.save_task_file File.open(@@task_file,"w") do |f| f << @@tasks.join(",") end end
end
Public Instance Methods
[](key)
click to toggle source
# File lib/dyndoc/document.rb, line 61 def [](key) @cfg[key] end
[]=(key,value)
click to toggle source
# File lib/dyndoc/document.rb, line 65 def []=(key,value) @cfg[key]=value return self end
append_cfg(cfg)
click to toggle source
append with partial match
# File lib/dyndoc/document.rb, line 49 def append_cfg(cfg) return unless cfg.respond_to? "[]" keys=@cfg.keys.map{|e| e.to_s}.sort cfg.each_key do |k| #like R, partial match of the parameter names if k2=keys.find{|e| e=~/^#{k}/} @cfg[k2.to_sym]=cfg[k] end end ## puts "append_cfg";p @cfg end
init_cfg(cfg=nil)
click to toggle source
# File lib/dyndoc/document.rb, line 37 def init_cfg(cfg=nil) @cfg=@@cfg.dup read_cfg(cfg) if cfg end
read_cfg(cfg)
click to toggle source
# File lib/dyndoc/document.rb, line 42 def read_cfg(cfg) cfg.each_key do |k| @cfg[k]=cfg[k] end end