Class: CVESchema::CVE::Timeline
- Inherits:
-
Object
- Object
- CVESchema::CVE::Timeline
- Includes:
- HasLangValue
- Defined in:
- lib/cve_schema/cve/timeline.rb
Overview
Represents a timeline entry in the "timeline"
JSON Array.
Instance Attribute Summary collapse
-
#time ⇒ DateTime
readonly
The time of the timeline event.
Attributes included from HasLangValue
Class Method Summary collapse
-
.from_json(json) ⇒ Hash{Symbol => Object}
Maps the parsed JSON to a Symbol Hash for #initialize.
-
.load(json) ⇒ Timeline
Loads the timeline object from the parsed JSON.
Instance Method Summary collapse
-
#initialize(time:, **kargs) ⇒ Timeline
constructor
Initializes the timeline object.
Methods included from HasLangValue
Constructor Details
#initialize(time:, **kargs) ⇒ Timeline
Initializes the timeline object.
23 24 25 26 27 |
# File 'lib/cve_schema/cve/timeline.rb', line 23 def initialize(time: , **kargs) super(**kargs) @time = time end |
Instance Attribute Details
#time ⇒ DateTime (readonly)
The time of the timeline event.
16 17 18 |
# File 'lib/cve_schema/cve/timeline.rb', line 16 def time @time end |
Class Method Details
.from_json(json) ⇒ Hash{Symbol => Object}
Maps the parsed JSON to a Symbol Hash for #initialize.
40 41 42 43 44 45 46 |
# File 'lib/cve_schema/cve/timeline.rb', line 40 def self.from_json(json) { lang: json['lang'], time: Timestamp.parse(json['time']), value: json['value'] } end |
.load(json) ⇒ Timeline
Loads the timeline object from the parsed JSON.
59 60 61 |
# File 'lib/cve_schema/cve/timeline.rb', line 59 def self.load(json) new(**from_json(json)) end |