class TheFox::Timr::Model::Config

Attributes

inital_version[RW]

The version String which the file was created with.

last_used_version[RW]

The version of the previous Timr run.

Public Class Methods

new() click to toggle source
Calls superclass method TheFox::Timr::Model::BasicModel::new
# File lib/timr/model/config.rb, line 14
def initialize
        super()
        
        @inital_version = nil
        @last_used_version = nil
end

Private Instance Methods

post_load_from_file() click to toggle source

BasicModel Hook

# File lib/timr/model/config.rb, line 32
def post_load_from_file
        @inital_version = @data.fetch('inital_version', VERSION)
        @last_used_version = @data.fetch('last_used_version', VERSION)
        
        if @last_used_version != VERSION
                @last_used_version = VERSION
                
                # Mark Config as changed.
                changed
        end
end
pre_save_to_file() click to toggle source

BasicModel Hook

# File lib/timr/model/config.rb, line 24
def pre_save_to_file
        @data = {
                'inital_version' => @inital_version || VERSION,
                'last_used_version' => VERSION,
        }
end