Sha256: 9094dd42d9b12d4a76129dc9920a11c01087452b4d9917c1e87daf60a13a4cce
Contents?: true
Size: 714 Bytes
Versions: 10
Compression:
Stored size: 714 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
10 entries across 10 versions & 1 rubygems