Sha256: 8a7c80f16b7385be197361354172ef4c2a44adf6a632f9b5ddb18c56f5936cf4

Contents?: true

Size: 943 Bytes

Versions: 4

Compression:

Stored size: 943 Bytes

Contents

module RelatonBib
  # Version
  class << self
    def version_hash_to_bib(ret)
      return unless ret[:version]
      ret[:version][:draft] = array(ret[:version][:draft])
      ret[:version] and ret[:version] = BibliographicItem::Version.new(
          ret[:version][:revision_date], ret[:version][:draft])
    end
  end

  class BibliographicItem
    class Version
      # @return [String]
      attr_reader :revision_date

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

      # @param revision_date [String]
      # @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.revision_date revision_date if revision_date
          draft.each { |d| builder.draft d }
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
relaton-bib-0.3.1 lib/relaton_bib/biblio_version.rb
relaton-bib-0.3.0 lib/relaton_bib/biblio_version.rb
relaton-bib-0.2.5 lib/relaton_bib/biblio_version.rb
relaton-bib-0.2.4 lib/relaton_bib/biblio_version.rb