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

Version Path
renalware-core-2.0.77 app/documents/renalware/dated_integer.rb
renalware-core-2.0.76 app/documents/renalware/dated_integer.rb
renalware-core-2.0.75 app/documents/renalware/dated_integer.rb
renalware-core-2.0.74 app/documents/renalware/dated_integer.rb
renalware-core-2.0.73 app/documents/renalware/dated_integer.rb
renalware-core-2.0.72 app/documents/renalware/dated_integer.rb
renalware-core-2.0.71 app/documents/renalware/dated_integer.rb
renalware-core-2.0.70 app/documents/renalware/dated_integer.rb
renalware-core-2.0.69 app/documents/renalware/dated_integer.rb
renalware-core-2.0.68 app/documents/renalware/dated_integer.rb
renalware-core-2.0.67 app/documents/renalware/dated_integer.rb
renalware-core-2.0.64 app/documents/renalware/dated_integer.rb
renalware-core-2.0.63 app/documents/renalware/dated_integer.rb
renalware-core-2.0.62 app/documents/renalware/dated_integer.rb
renalware-core-2.0.61 app/documents/renalware/dated_integer.rb
renalware-core-2.0.60 app/documents/renalware/dated_integer.rb
renalware-core-2.0.58 app/documents/renalware/dated_integer.rb
renalware-core-2.0.57 app/documents/renalware/dated_integer.rb
renalware-core-2.0.56 app/documents/renalware/dated_integer.rb
renalware-core-2.0.55 app/documents/renalware/dated_integer.rb