Method: OpenC3::TriggerGroupModel#initialize

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

#initialize(name:, scope:, shard: 0, updated_at: nil) ⇒ TriggerGroupModel

Returns a new instance of TriggerGroupModel.



69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/openc3/models/trigger_group_model.rb', line 69

def initialize(name:, scope:, shard: 0, updated_at: nil)
  unless name.is_a?(String)
    raise TriggerGroupInputError.new "invalid group name: '#{name}'"
  end
  if name.include?('_')
    raise TriggerGroupInputError.new "group name '#{name}' can not include an underscore"
  end
  super("#{scope}#{PRIMARY_KEY}", name: name, scope: scope)
  @microservice_name = "#{scope}__TRIGGER_GROUP__#{name}"
  @shard = shard.to_i # to_i to handle nil
  @updated_at = updated_at
end