class Daedalus::Path
Attributes
data[R]
path[R]
Public Class Methods
new(path)
click to toggle source
# File lib/daedalus.rb 294 def initialize(path) 295 @path = path 296 297 if File.exist?(data_path) 298 begin 299 File.open data_path, "rb" do |f| 300 @data = Marshal.load(f.read) 301 end 302 rescue 303 STDERR.puts "WARNING: Path#initialize: load '#{data_path}' failed" 304 @data = {} 305 end 306 else 307 @data = {} 308 end 309 end
Public Instance Methods
artifacts_path()
click to toggle source
# File lib/daedalus.rb 317 def artifacts_path 318 dir = File.join File.dirname(@path), "artifacts" 319 Dir.mkdir dir unless File.directory?(dir) 320 return dir 321 end
basename()
click to toggle source
# File lib/daedalus.rb 313 def basename 314 File.basename @path 315 end
data_path()
click to toggle source
# File lib/daedalus.rb 323 def data_path 324 File.join artifacts_path, "#{basename}.data" 325 end
save!()
click to toggle source
# File lib/daedalus.rb 327 def save! 328 File.open(data_path, "wb") do |f| 329 f << Marshal.dump(data) 330 end 331 end