Sha256: b4c85dd41c351b2793fe70146c5c73a5003bf42c8775ca76049e8f8ae0a1f164

Contents?: true

Size: 798 Bytes

Versions: 10

Compression:

Stored size: 798 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

10 entries across 10 versions & 1 rubygems

Version Path
relaton-bib-0.2.3 lib/relaton_bib/validity.rb
relaton-bib-0.2.2 lib/relaton_bib/validity.rb
relaton-bib-0.2.1 lib/relaton_bib/validity.rb
relaton-bib-0.2.0 lib/relaton_bib/validity.rb
relaton-bib-0.1.6 lib/relaton_bib/validity.rb
relaton-bib-0.1.5 lib/relaton_bib/validity.rb
relaton-bib-0.1.3 lib/relaton_bib/validity.rb
relaton-bib-0.1.2 lib/relaton_bib/validity.rb
relaton-bib-0.1.1 lib/relaton_bib/validity.rb
relaton-bib-0.1.0 lib/relaton_bib/validity.rb