Sha256: 9755f6b46ee4058e25fd3d72d3ee790915ba0c11bcecbee664a04d6e6a5d17c7
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
module RelatonBib class Validity FORMAT = "%Y-%m-%d %H:%M" # @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) 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 # @return [Hash] def to_hash hash = {} hash[:begins] = begins.strftime(FORMAT) if begins hash[:ends] = ends.strftime(FORMAT) if ends hash[:revision] = revision.strftime(FORMAT) if revision hash end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
relaton-bib-0.3.4 | lib/relaton_bib/validity.rb |