Method: OpenC3::ReactionModel.from_json

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

.from_json(json, name:, scope:) ⇒ ReactionModel



281
282
283
284
285
286
287
# File 'lib/openc3/models/reaction_model.rb', line 281

def self.from_json(json, name:, scope:)
  json = JSON.parse(json, :allow_nan => true, :create_additions => true) if String === json
  raise "json data is nil" if json.nil?

  json.transform_keys!(&:to_sym)
  self.new(**json, name: name, scope: scope)
end