From 2a0e3f7e186f219720dcba19cab66d0a294e6fd3 Mon Sep 17 00:00:00 2001 From: Cyberarm Date: Thu, 18 Jun 2020 15:26:25 -0500 Subject: [PATCH] Added revision number to config --- lib/backend.rb | 1 + lib/config.rb | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/backend.rb b/lib/backend.rb index 6909cf2..4c7324b 100644 --- a/lib/backend.rb +++ b/lib/backend.rb @@ -12,6 +12,7 @@ module TAC def config_changed! @config.configuration.updated_at = Time.now + @config.configuration.revision += 1 @config_changed = true end diff --git a/lib/config.rb b/lib/config.rb index c0d2921..fad2630 100644 --- a/lib/config.rb +++ b/lib/config.rb @@ -41,10 +41,11 @@ module TAC end class Configuration - attr_accessor :created_at, :updated_at, :spec_version - def initialize(created_at:, updated_at:, spec_version:) + attr_accessor :created_at, :updated_at, :spec_version, :revision + def initialize(created_at:, updated_at:, spec_version:, revision:) @created_at, @updated_at = created_at, updated_at @spec_version = spec_version + @revision = revision end def to_json(*args) @@ -52,6 +53,7 @@ module TAC created_at: @created_at, updated_at: @updated_at, spec_version: @spec_version, + revision: @revision, }.to_json(*args) end @@ -59,7 +61,8 @@ module TAC Configuration.new( created_at: hash[:created_at], updated_at: hash[:updated_at], - spec_version: hash[:spec_version] + spec_version: hash[:spec_version], + revision: hash[:revision], ) end end