Code Coverage
 
Lines
Covered
89.47% covered (warning)
89.47%
17 / 19
1
module TheFox
1
module Timr
1
module Model
1
class Config < BasicModel
# The version String which the file was created with.
1
attr_accessor :inital_version
# The version of the previous Timr run.
1
attr_accessor :last_used_version
1
def initialize
6
super()
6
@inital_version = nil
6
@last_used_version = nil
end
1
private
# BasicModel Hook
1
def pre_save_to_file
5
@data = {
'inital_version' => @inital_version || VERSION,
'last_used_version' => VERSION,
}
end
# BasicModel Hook
1
def post_load_from_file
2
@inital_version = @data.fetch('inital_version', VERSION)
2
@last_used_version = @data.fetch('last_used_version', VERSION)
2
if @last_used_version != VERSION
0
@last_used_version = VERSION
# Mark Config as changed.
0
changed
end
end
end # class Config
end # module Model
end # module Timr
end #module TheFox