module CVESchema::CVE::HasLangValue::ClassMethods

Class methods.

Constants

LANG

Public Instance Methods

from_json(json) click to toggle source

Maps the parsed JSON to a Symbol Hash for {#initialize}.

@param [Hash{String => Object}] json

The parsed JSON.

@return [Hash{Symbol => Object}]

The mapped Symbol Hash.
# File lib/cve_schema/cve/has_lang_value.rb, line 38
def from_json(json)
  {
    lang:  LANG.fetch(json['lang'],json['lang']),
    value: json['value']
  }
end
load(json) click to toggle source

Loads the objects from the parsed JSON.

@param [Hash{String => Object}] json

The parsed JSON.

@return [HasLangValue]

The loaded object.
# File lib/cve_schema/cve/has_lang_value.rb, line 54
def load(json)
  new(**from_json(json))
end