debian-mirror-gitlab/app/serializers/analytics_summary_entity.rb

16 lines
301 B
Ruby
Raw Normal View History

2018-11-18 11:00:15 +05:30
# frozen_string_literal: true
2017-08-17 22:00:37 +05:30
class AnalyticsSummaryEntity < Grape::Entity
expose :value, safe: true
expose :title
2020-04-22 19:07:51 +05:30
expose :unit, if: { with_unit: true }
private
def value
return object.value if object.value.is_a? String
object.value&.nonzero? ? object.value.to_s : '-'
end
2017-08-17 22:00:37 +05:30
end