Sha256: 0d40321d953b550b4c2609e4d902038f610b1fcc64a37a57314a3d6b1f372a7c
Contents?: true
Size: 692 Bytes
Versions: 1
Compression:
Stored size: 692 Bytes
Contents
require 'forwardable' module Dyndnsd class Database extend Forwardable def_delegators :@db, :[], :[]=, :each, :has_key? # @param db_file [String] def initialize(db_file) @db_file = db_file end # @return [void] def load if File.file?(@db_file) @db = JSON.parse(File.read(@db_file, mode: 'r')) else @db = {} end @db_hash = @db.hash end # @return [void] def save Helper.span('database_save') do |_span| File.open(@db_file, 'w') { |f| JSON.dump(@db, f) } @db_hash = @db.hash end end # @return [Boolean] def changed? @db_hash != @db.hash end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dyndnsd-2.1.1 | lib/dyndnsd/database.rb |