Class: OpenC3::SettingsModel
- Defined in:
- lib/openc3/models/settings_model.rb
Constant Summary collapse
- PRIMARY_KEY =
'openc3__settings'
Instance Attribute Summary
Attributes inherited from Model
#name, #plugin, #scope, #updated_at
Class Method Summary collapse
- .all(scope: nil) ⇒ Object
-
.get(name:, scope: nil) ⇒ Object
NOTE: The following three class methods are used by the ModelController and are reimplemented to enable various Model class methods to work.
- .names(scope: nil) ⇒ Object
Instance Method Summary collapse
-
#as_json(*a) ⇒ Hash
JSON encoding of this model.
-
#initialize(name:, scope: nil, data:) ⇒ SettingsModel
constructor
END NOTE.
Methods inherited from Model
#as_config, #create, #deploy, #destroy, #destroyed?, filter, find_all_by_plugin, from_json, get_all_models, get_model, handle_config, set, store, #undeploy, #update
Constructor Details
#initialize(name:, scope: nil, data:) ⇒ SettingsModel
END NOTE
41 42 43 44 |
# File 'lib/openc3/models/settings_model.rb', line 41 def initialize(name:, scope: nil, data:) super(PRIMARY_KEY, name: name, scope: scope) @data = data end |
Class Method Details
.all(scope: nil) ⇒ Object
36 37 38 |
# File 'lib/openc3/models/settings_model.rb', line 36 def self.all(scope: nil) super(PRIMARY_KEY) end |
.get(name:, scope: nil) ⇒ Object
NOTE: The following three class methods are used by the ModelController and are reimplemented to enable various Model class methods to work
28 29 30 |
# File 'lib/openc3/models/settings_model.rb', line 28 def self.get(name:, scope: nil) super(PRIMARY_KEY, name: name) end |
.names(scope: nil) ⇒ Object
32 33 34 |
# File 'lib/openc3/models/settings_model.rb', line 32 def self.names(scope: nil) super(PRIMARY_KEY) end |
Instance Method Details
#as_json(*a) ⇒ Hash
Returns JSON encoding of this model.
47 48 49 50 51 52 53 |
# File 'lib/openc3/models/settings_model.rb', line 47 def as_json(*a) { 'name' => @name, 'data' => @data.as_json(*a), 'updated_at' => @updated_at } end |