Sha256: 824ec8846854dd3539fa7a3c8901b1ab5a2a016d7a2a85008839c0aa84f815f9

Contents?: true

Size: 456 Bytes

Versions: 142

Compression:

Stored size: 456 Bytes

Contents

# frozen_string_literal: true

require "document/enum"

module Renalware
  class DatedTest < NestedAttribute
    attribute :result, Document::Enum, enums: %i(negative positive not_done)
    attribute :recorded_on, Date

    validates :recorded_on, timeliness: { type: :date, allow_blank: true }

    def to_s
      datestamp = recorded_on.present? ? "(#{I18n.l(recorded_on)})" : nil
      [result.try(:text), datestamp].compact.join(" ")
    end
  end
end

Version data entries

142 entries across 142 versions & 1 rubygems

Version Path
renalware-core-2.0.18 app/documents/renalware/dated_test.rb
renalware-core-2.0.17 app/documents/renalware/dated_test.rb