class WarpEngine::SoftwareStatus
A status a software may carry (table software_statuses): its key (the value of WarpEngine::Software status), a display label and position (scope ordered), whether clients list it by default (default_visible) and a badge style hint. The table seeds itself with DEFAULTS when empty. Changes refresh every shelf.
Constants
- DEFAULTS
-
The statuses seeded into an empty table: released, demo, development and archived.
- KEY_FORMAT
-
Allowed characters of a status key: lower-case letters, digits, underscore and hyphen.
Public Class Methods
Source
# File app/models/warp_engine/software_status.rb, line 50 def self.default_visible_keys ensured.where(default_visible: true).pluck(:key) end
Returns the keys of the statuses listed by default, in display order.
Source
# File app/models/warp_engine/software_status.rb, line 39 def self.ensured seed_defaults! ordered end
Seeds the defaults when needed and returns every status in display order.
Source
# File app/models/warp_engine/software_status.rb, line 45 def self.keys ensured.pluck(:key) end
Returns every status key in display order.
Source
# File app/models/warp_engine/software_status.rb, line 32 def self.seed_defaults! return unless none? DEFAULTS.each { |attributes| create!(attributes) } end
Creates DEFAULTS when the table is empty; does nothing otherwise.