Module: QiitaMail::MarshalFile

Defined in:
lib/qiita_mail/marshal_file.rb

Class Method Summary collapse

Class Method Details

.load(filename) ⇒ Object



22
23
24
25
26
27
# File 'lib/qiita_mail/marshal_file.rb', line 22

def load(filename)
  # puts "MarshalFile#load <- #{filename}"
  open(filename) do |f|
    Marshal.load(f.read)
  end
end

.save(filename, obj) ⇒ Object



15
16
17
18
19
20
# File 'lib/qiita_mail/marshal_file.rb', line 15

def save(filename, obj)
  # puts "MarshalFile#save -> #{filename}"
  open(filename, "w") do |f|
    f.write Marshal.dump(obj)
  end
end