class Benchmark::Memory::HeldResults::EntrySerializer

Serialize entrys for holding between runs.

Public Instance Methods

load(hash) click to toggle source

Convert a JSON hash into an Entry.

@param hash [Hash] A JSON document hash.

@return [Report::Entry]

# 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() click to toggle source

Convert the entry to a Hash.

@return [Hash] The entry as a Hash.

# 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