Sha256: 0f85b77fcff32a682be97d558ac4a501f790887188158862f6a19cbc4ef0cc42
Contents?: true
Size: 445 Bytes
Versions: 55
Compression:
Stored size: 445 Bytes
Contents
# frozen_string_literal: true module Renalware class DatedInteger < NestedAttribute attribute :result, Integer attribute :recorded_on, Date validates :recorded_on, timeliness: { type: :date, allow_blank: true } validates :recorded_on, presence: { if: ->{ result.present? } } def to_s datestamp = recorded_on.present? ? "(#{I18n.l(recorded_on)})" : nil [result, datestamp].compact.join(" ") end end end
Version data entries
55 entries across 55 versions & 1 rubygems