Module: CVESchema::CVE::HasLangValue::ClassMethods
- Defined in:
- lib/cve_schema/cve/has_lang_value.rb
Overview
Class methods.
Constant Summary collapse
- LANG =
{ 'eng' => :eng, # English 'es' => :es, # Spanish }
Instance Method Summary collapse
-
#from_json(json) ⇒ Hash{Symbol => Object}
Maps the parsed JSON to a Symbol Hash for #initialize.
-
#load(json) ⇒ HasLangValue
Loads the objects from the parsed JSON.
Instance Method Details
#from_json(json) ⇒ Hash{Symbol => Object}
Maps the parsed JSON to a Symbol Hash for CVESchema::CVE::HasLangValue#initialize.
38 39 40 41 42 43 |
# 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) ⇒ HasLangValue
Loads the objects from the parsed JSON.
54 55 56 |
# File 'lib/cve_schema/cve/has_lang_value.rb', line 54 def load(json) new(**from_json(json)) end |