Sha256: 8435b148234c148c3d3bf3f3a6e316f372e85ea547716028dc9e0ab0f83a9b04

Contents?: true

Size: 447 Bytes

Versions: 10

Compression:

Stored size: 447 Bytes

Contents

require "jsonapi/serializer"

module EasyML
  class PredictionSerializer
    include JSONAPI::Serializer

    attribute :prediction do |object|
      case object.prediction_value
      when Hash
        object.prediction_value.symbolize_keys.dig(:value)
      when Numeric
        object.prediction_value
      end
    end

    attributes :id,
               :prediction_type,
               :raw_input,
               :normalized_input
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
easy_ml-0.2.0.pre.rc52 app/serializers/easy_ml/prediction_serializer.rb
easy_ml-0.2.0.pre.rc51 app/serializers/easy_ml/prediction_serializer.rb
easy_ml-0.2.0.pre.rc50 app/serializers/easy_ml/prediction_serializer.rb
easy_ml-0.2.0.pre.rc49 app/serializers/easy_ml/prediction_serializer.rb
easy_ml-0.2.0.pre.rc48 app/serializers/easy_ml/prediction_serializer.rb
easy_ml-0.2.0.pre.rc47 app/serializers/easy_ml/prediction_serializer.rb
easy_ml-0.2.0.pre.rc46 app/serializers/easy_ml/prediction_serializer.rb
easy_ml-0.2.0.pre.rc45 app/serializers/easy_ml/prediction_serializer.rb
easy_ml-0.2.0.pre.rc44 app/serializers/easy_ml/prediction_serializer.rb
easy_ml-0.2.0.pre.rc43 app/serializers/easy_ml/prediction_serializer.rb