Sha256: 87a059e3ac708f414266225f872c47cb0b460bd9e049d2dbc56b1f0ad4063ae4

Contents?: true

Size: 522 Bytes

Versions: 27

Compression:

Stored size: 522 Bytes

Contents

require "document/enum"

module Renalware
  class YearDatedConfirmation < NestedAttribute
    attribute :status, Document::Enum, enums: %i(yes no unknown)
    attribute :confirmed_on_year, Integer

    validates :confirmed_on_year, numericality: { allow_blank: true, only_integer: true }

    def self.valid_years
      (1900..Time.zone.today.year).to_a
    end

    def to_s
      datestamp = confirmed_on_year.present? ? "(#{confirmed_on_year})" : nil
      [status&.text, datestamp].compact.join(" ")
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
renalware-core-2.0.16 app/documents/renalware/year_dated_confirmation.rb
renalware-core-2.0.15 app/documents/renalware/year_dated_confirmation.rb
renalware-core-2.0.14 app/documents/renalware/year_dated_confirmation.rb
renalware-core-2.0.13 app/documents/renalware/year_dated_confirmation.rb
renalware-core-2.0.12 app/documents/renalware/year_dated_confirmation.rb
renalware-core-2.0.11 app/documents/renalware/year_dated_confirmation.rb
renalware-core-2.0.9 app/documents/renalware/year_dated_confirmation.rb
renalware-core-2.0.8 app/documents/renalware/year_dated_confirmation.rb
renalware-core-2.0.7 app/documents/renalware/year_dated_confirmation.rb
renalware-core-2.0.5 app/documents/renalware/year_dated_confirmation.rb
renalware-core-2.0.4 app/documents/renalware/year_dated_confirmation.rb
renalware-core-2.0.3 app/documents/renalware/year_dated_confirmation.rb
renalware-core-2.0.2 app/documents/renalware/year_dated_confirmation.rb
renalware-core-2.0.1 app/documents/renalware/year_dated_confirmation.rb
renalware-core-2.0.0 app/documents/renalware/year_dated_confirmation.rb
renalware-core-2.0.0.pre.rc13 app/documents/renalware/year_dated_confirmation.rb
renalware-core-2.0.0.pre.rc11 app/documents/renalware/year_dated_confirmation.rb
renalware-core-2.0.0.pre.rc10 app/documents/renalware/year_dated_confirmation.rb
renalware-core-2.0.0.pre.rc9 app/documents/renalware/year_dated_confirmation.rb
renalware-core-2.0.0.pre.rc8 app/documents/renalware/year_dated_confirmation.rb