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.
15 16 17 18 19 20 21 |
# File 'lib/benchmark/memory/held_results/entry_serializer.rb', line 15 def load(hash) @object = Report::Entry.new( hash["item"], MeasurementSerializer.load(hash["measurement"]) ) self end |
#to_h ⇒ Hash
Convert the entry to a Hash.
26 27 28 29 30 31 |
# File 'lib/benchmark/memory/held_results/entry_serializer.rb', line 26 def to_h { :item => object.label, :measurement => MeasurementSerializer.new(object.measurement).to_h, } end |