Class: MGit::AppData::AppDataVersion

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/mgit/appdata.rb

Overview

Base class for data storage versions. #

Direct Known Subclasses

AppDataVersion1, LegacyAppData

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.activeObject



45
46
47
# File 'lib/mgit/appdata.rb', line 45

def self.active
  sorted.find { |v| v.active? }
end

.inherited(version) ⇒ Object



31
32
33
34
35
# File 'lib/mgit/appdata.rb', line 31

def self.inherited(version)
  @versions ||= []
  @versions << version.new
  super
end

.latestObject



49
50
51
# File 'lib/mgit/appdata.rb', line 49

def self.latest
  sorted.last
end

.sortedObject



37
38
39
# File 'lib/mgit/appdata.rb', line 37

def self.sorted
  @versions.sort_by { |v| v.version }
end

.updatesObject



41
42
43
# File 'lib/mgit/appdata.rb', line 41

def self.updates
  sorted.drop_while { |v| !v.active? }.drop(1)
end

Instance Method Details

#<=>(other) ⇒ Object



55
56
57
# File 'lib/mgit/appdata.rb', line 55

def <=>(other)
  version <=> other.version
end