Ravn::BDE::MissionRecord::

Version class

A Mission version record for events and bolt states.

Public Class Methods

current()

Save and return the current running version row, caching it for the duration of the BDE.

# File lib/ravn/bde/mission_record/version.rb, line 50
def self::current
        return self.for_mission( Ravn::BDE.mission )
end
dataset=( ... )

Clear the cached versions when the database changes.

# File lib/ravn/bde/mission_record/version.rb, line 56
def self::dataset=( ... )
        self.log.warn "Clearing the mission version cache"
        self.by_mission_cache.clear

        super
end
for_mission( mission )

Create or return the Version that correlates with the given mission.

# File lib/ravn/bde/mission_record/version.rb, line 33
def self::for_mission( mission )
        return self.by_mission_cache.fetch( mission ) do |*|
                attributes = {
                        bde_version:     Ravn::BDE::VERSION,
                        mission_format:  mission[ :format_version ],
                        mission_version: mission[ :version ],
                        mission_id:      mission[ :id ]
                }

                self.by_mission_cache[ mission ] = self.find_or_create( attributes )
        end
end

Public Instance Methods

bolts()

Finished bolts, initiated by the user of this bde.

# File lib/ravn/bde/mission_record/version.rb, line 70
one_to_many :bolts
events()

All seen network events.

# File lib/ravn/bde/mission_record/version.rb, line 74
one_to_many :events