Method: OpenC3::ScopeModel#initialize

Defined in:
lib/openc3/models/scope_model.rb

#initialize(name:, text_log_cycle_time: 600, text_log_cycle_size: 50_000_000, text_log_retain_time: nil, tool_log_retain_time: nil, cleanup_poll_time: 600, command_authority: false, critical_commanding: "OFF", shard: 0, updated_at: nil) ⇒ ScopeModel

Returns a new instance of ScopeModel.



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/openc3/models/scope_model.rb', line 93

def initialize(name:,
  text_log_cycle_time: 600,
  text_log_cycle_size: 50_000_000,
  text_log_retain_time: nil,
  tool_log_retain_time: nil,
  cleanup_poll_time: 600,
  command_authority: false,
  critical_commanding: "OFF",
  shard: 0,
  updated_at: nil
)
  super(
    PRIMARY_KEY,
    name: name,
    updated_at: updated_at,
    # This sets the @scope variable which is sort of redundant for the ScopeModel
    # (since its the same as @name) but every model has a @scope
    scope: name
  )
  @text_log_cycle_time = text_log_cycle_time
  @text_log_cycle_size = text_log_cycle_size
  @text_log_retain_time = text_log_retain_time
  @tool_log_retain_time = tool_log_retain_time
  @cleanup_poll_time = cleanup_poll_time
  @command_authority = command_authority
  @critical_commanding = critical_commanding.to_s.upcase
  @critical_commanding = "OFF" if @critical_commanding.length == 0
  if not ["OFF", "NORMAL", "ALL"].include?(@critical_commanding)
    raise "Invalid value for critical_commanding: #{@critical_commanding}"
  end
  @shard = shard.to_i # to_i to handle nil
  @children = []
end