Class: Dyndnsd::Database
- Inherits:
-
Object
- Object
- Dyndnsd::Database
- Extended by:
- Forwardable
- Defined in:
- lib/dyndnsd/database.rb
Instance Method Summary collapse
- #changed? ⇒ Boolean
-
#initialize(db_file) ⇒ Database
constructor
A new instance of Database.
- #load ⇒ void
- #save ⇒ void
Constructor Details
#initialize(db_file) ⇒ Database
Returns a new instance of Database.
12 13 14 |
# File 'lib/dyndnsd/database.rb', line 12 def initialize(db_file) @db_file = db_file end |
Instance Method Details
#changed? ⇒ Boolean
35 36 37 |
# File 'lib/dyndnsd/database.rb', line 35 def changed? @db_hash != @db.hash end |
#load ⇒ void
This method returns an undefined value.
17 18 19 20 21 22 23 24 |
# File 'lib/dyndnsd/database.rb', line 17 def load if File.file?(@db_file) @db = JSON.parse(File.read(@db_file, mode: 'r')) else @db = {} end @db_hash = @db.hash end |