Sha256: 60fdc6a19fe0eaca0782927d9af4756e8d549e146d2cf99c5d4f4c1d2744b982

Contents?: true

Size: 918 Bytes

Versions: 29

Compression:

Stored size: 918 Bytes

Contents

module RelatonBib
  # Version
  class BibliographicItem
    class Version
      include RelatonBib

      # @return [String, NilClass]
      attr_reader :revision_date

      # @return [Array<String>]
      attr_reader :draft

      # @param revision_date [String, NilClass]
      # @param draft [Array<String>]
      def initialize(revision_date = nil, draft = [])
        @revision_date = revision_date
        @draft         = draft
      end

      # @param builder [Nokogiri::XML::Builder]
      def to_xml(builder)
        builder.version do
          builder.send("revision-date", revision_date) if revision_date
          draft.each { |d| builder.draft d }
        end
      end

      # @return [Hash]
      def to_hash
        hash = {}
        hash["revision_date"] = revision_date if revision_date
        hash["draft"] = single_element_array(draft) if draft&.any?
        hash
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 2 rubygems

Version Path
metanorma-cli-1.3.4 gems/ruby/2.6.0/gems/relaton-bib-1.2.4/lib/relaton_bib/biblio_version.rb
metanorma-cli-1.3.3.1 gems/ruby/2.6.0/gems/relaton-bib-1.2.4/lib/relaton_bib/biblio_version.rb
relaton-bib-1.2.4 lib/relaton_bib/biblio_version.rb
relaton-bib-1.2.2 lib/relaton_bib/biblio_version.rb
relaton-bib-1.2.1 lib/relaton_bib/biblio_version.rb
relaton-bib-1.2.0 lib/relaton_bib/biblio_version.rb
relaton-bib-1.1.1 lib/relaton_bib/biblio_version.rb
relaton-bib-1.1.0 lib/relaton_bib/biblio_version.rb
relaton-bib-1.0.4 lib/relaton_bib/biblio_version.rb
relaton-bib-1.0.3 lib/relaton_bib/biblio_version.rb
relaton-bib-1.0.2 lib/relaton_bib/biblio_version.rb
relaton-bib-1.0.1 lib/relaton_bib/biblio_version.rb
relaton-bib-1.0.0 lib/relaton_bib/biblio_version.rb
relaton-bib-0.9.2 lib/relaton_bib/biblio_version.rb
relaton-bib-0.9.1 lib/relaton_bib/biblio_version.rb
relaton-bib-0.9.0 lib/relaton_bib/biblio_version.rb
relaton-bib-0.8.1 lib/relaton_bib/biblio_version.rb
relaton-bib-0.8.0 lib/relaton_bib/biblio_version.rb
relaton-bib-0.7.0 lib/relaton_bib/biblio_version.rb
relaton-bib-0.6.0 lib/relaton_bib/biblio_version.rb