Sha256: 3694176d6c6d2a1a26cff6458e6b7b2ef1b123957a8ca0d8be0187dda508806e
Contents?: true
Size: 718 Bytes
Versions: 64
Compression:
Stored size: 718 Bytes
Contents
# frozen_string_literal: true module Decidim # # Presenter for metric objects # class MetricObjectPresenter < SimpleDelegator def attr_int(attr, default: 0) return default unless __getobj__ __getobj__[attr] || default end def attr_string(attr, default: "") return default unless __getobj__ __getobj__[attr].presence || default end def attr_date(attr, default: "") return default unless __getobj__ __getobj__[attr].try(:strftime, "%Y-%m-%d") || default end def attr_translated(attr, locale: I18n.locale, default: "") return default unless __getobj__ __getobj__[attr].try(:[], locale.to_s).presence || default end end end
Version data entries
64 entries across 64 versions & 1 rubygems