Sha256: df46b0f6faae52695e7fef3045293b6b2839a06c16af1fa04394e38d2ae91359

Contents?: true

Size: 783 Bytes

Versions: 5

Compression:

Stored size: 783 Bytes

Contents

module Tc211
  module Termbase
    module Glossarist
      class Concept < ::Glossarist::LocalizedConcept
        attr_accessor :status, :dateAccepted

        def uuid
          @uuid ||= ::Glossarist::Utilities::UUID.uuid_v5(
            ::Glossarist::Utilities::UUID::OID_NAMESPACE,
            to_h(only_data: true).to_yaml,
          )
        end

        def to_h(only_data: false)
          data_hash = super()
          return data_hash if only_data

          data_hash.merge(register_info)
        end

        def register_info
          date_accepted = dates.find(&:accepted?)

          {
            "dateAccepted" => date_accepted&.date&.dup,
            "id" => uuid,
            "status" => entry_status,
          }.compact
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tc211-termbase-0.2.8 lib/tc211/termbase/glossarist/concept.rb
tc211-termbase-0.2.7 lib/tc211/termbase/glossarist/concept.rb
tc211-termbase-0.2.6 lib/tc211/termbase/glossarist/concept.rb
tc211-termbase-0.2.5 lib/tc211/termbase/glossarist/concept.rb
tc211-termbase-0.2.4 lib/tc211/termbase/glossarist/concept.rb