Class: Benchmark::Memory::HeldResults::EntrySerializer
- Inherits:
-
Serializer
- Object
- Serializer
- Benchmark::Memory::HeldResults::EntrySerializer
- Defined in:
- lib/benchmark/memory/held_results/entry_serializer.rb
Overview
Serialize entrys for holding between runs.
Instance Attribute Summary
Attributes inherited from Serializer
Instance Method Summary collapse
-
#load(hash) ⇒ Report::Entry
Convert a JSON hash into an Entry.
-
#to_h ⇒ Hash
Convert the entry to a Hash.
Methods inherited from Serializer
Constructor Details
This class inherits a constructor from Benchmark::Memory::HeldResults::Serializer
Instance Method Details
#load(hash) ⇒ Report::Entry
Convert a JSON hash into an Entry.
17 18 19 20 21 22 23 |
# File 'lib/benchmark/memory/held_results/entry_serializer.rb', line 17 def load(hash) @object = Report::Entry.new( hash['item'], MeasurementSerializer.load(hash['measurement']) ) self end |
#to_h ⇒ Hash
Convert the entry to a Hash.
28 29 30 31 32 33 |
# File 'lib/benchmark/memory/held_results/entry_serializer.rb', line 28 def to_h { item: object.label, measurement: MeasurementSerializer.new(object.measurement).to_h } end |