class AnyStyle::Dictionary::Marshal
Public Class Methods
new(options = {})
click to toggle source
Calls superclass method
AnyStyle::Dictionary::new
# File lib/anystyle/dictionary/marshal.rb 8 def initialize(options = {}) 9 super(self.class.defaults.merge(options)) 10 end
Public Instance Methods
open()
click to toggle source
# File lib/anystyle/dictionary/marshal.rb 12 def open 13 if File.exists?(options[:path]) 14 @db = ::Marshal.load(File.open(options[:path])) 15 else 16 @db = {} 17 end 18 self 19 ensure 20 if empty? 21 populate! 22 if File.writable?(options[:path]) 23 ::Marshal.dump(db, File.open(options[:path], 'wb')) 24 end 25 end 26 end