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

gem: add solargraph support

This commit is contained in:
cn
2020-02-28 15:13:28 +01:00
parent 6d0457d70c
commit 73dbf2a5fa
14 changed files with 145 additions and 2 deletions

View File

@@ -7,10 +7,12 @@ module Dyndnsd
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.open(@db_file, 'r', &:read))
@@ -20,6 +22,7 @@ module Dyndnsd
@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) }
@@ -27,6 +30,7 @@ module Dyndnsd
end
end
# @return [Boolean]
def changed?
@db_hash != @db.hash
end