Sha256: b8f56cdfc6db0c6c6844083c46094ce0ac6b2346a6560155a6abf4e148407b5d

Contents?: true

Size: 799 Bytes

Versions: 2

Compression:

Stored size: 799 Bytes

Contents

module RelatonBib
  class Validity
    # @return [Time, NilClass]
    attr_reader :begins

    # @return [Time, NilClass]
    attr_reader :ends

    # @return [Time, NilClass]
    attr_reader :revision

    # @param begins [Time, NilClass]
    # @param ends [Time, NilClass]
    # @param revision [Time, NilClass]
    def initialize(begins: nil, ends: nil, revision: nil)
      @begins   = begins
      @ends     = ends
      @revision = revision
    end

    # @param [Nokogiri::XML::Builder]
    def to_xml(builder)
      format = "%Y-%m-%d %H:%M"
      builder.validity do
        builder.validityBegins begins.strftime(format) if begins
        builder.validityEnds ends.strftime(format) if ends
        builder.validityRevision revision.strftime(format) if revision
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
relaton-bib-0.3.3 lib/relaton_bib/validity.rb
relaton-bib-0.3.2 lib/relaton_bib/validity.rb