Class: ScoutApm::Serializers::HistogramsSerializerToJson

Inherits:
Object
  • Object
show all
Defined in:
lib/scout_apm/serializers/histograms_serializer_to_json.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(histograms) ⇒ HistogramsSerializerToJson

Returns a new instance of HistogramsSerializerToJson.



7
8
9
# File 'lib/scout_apm/serializers/histograms_serializer_to_json.rb', line 7

def initialize(histograms)
  @histograms = histograms
end

Instance Attribute Details

#histogramsObject (readonly)

Returns the value of attribute histograms.



5
6
7
# File 'lib/scout_apm/serializers/histograms_serializer_to_json.rb', line 5

def histograms
  @histograms
end

Instance Method Details

#as_jsonObject



11
12
13
14
15
16
17
18
# File 'lib/scout_apm/serializers/histograms_serializer_to_json.rb', line 11

def as_json
  histograms.map do |histo|
    {
      "name" => histo.name,
      "histogram" => histo.histogram.as_json,
    }
  end
end