1
0
mirror of https://github.com/cmur2/dyndnsd.git synced 2025-08-08 08:33:56 +02:00

gem: fix applicable rubocop todos

This commit is contained in:
cn
2018-02-23 12:54:43 +01:00
parent 9a7c20babb
commit 21857959b5
14 changed files with 142 additions and 401 deletions

View File

@@ -4,27 +4,27 @@ require 'forwardable'
module Dyndnsd
class Database
extend Forwardable
def_delegators :@db, :[], :[]=, :each, :has_key?
def initialize(db_file)
@db_file = db_file
end
def load
if File.file?(@db_file)
@db = JSON.load(File.open(@db_file, 'r') { |f| f.read })
@db = JSON.parse(File.open(@db_file, 'r', &:read))
else
@db = {}
end
@db_hash = @db.hash
end
def save
File.open(@db_file, 'w') { |f| JSON.dump(@db, f) }
@db_hash = @db.hash
end
def changed?
@db_hash != @db.hash
end