class DYAutomate::DYBaseObj

Public Class Methods

fromFile(path) click to toggle source
# File lib/Core/DYBaseObj.rb, line 13
def self.fromFile(path)
  if File.exist?(path)
    content = File.open(path, 'r:utf-8', &:read)
    eval(content,nil,path.to_s)
  end
end
fromYAML(path) click to toggle source

加载从yaml

# File lib/Core/DYBaseObj.rb, line 21
def self.fromYAML(path)
  if File.exist?(path)
    content = File.open(path)
    YAML.load(content)
  end
end
new() { |self| ... } click to toggle source
Calls superclass method
# File lib/Core/DYBaseObj.rb, line 8
def initialize
  super
  yield self if block_given?
end

Public Instance Methods

doCacheByYAML(path) click to toggle source

以yaml缓存

# File lib/Core/DYBaseObj.rb, line 29
def doCacheByYAML(path)
  if path
    File.open(path, "w") { |file| YAML.dump(self, file) }
  end
end