Sha256: 4a51750dc4b7f97c70539d9a21552595b59cbf5e7048dc3131272c113d4408c2

Contents?: true

Size: 1.12 KB

Versions: 64

Compression:

Stored size: 1.12 KB

Contents

module RelatonNist
  class CommentPeriod
    # @return [Date]
    attr_reader :from

    # @rerurn [Date, NilClass]
    attr_reader :to

    # @return [Date, NilClass]
    attr_reader :extended

    # @param from [Date]
    # @param to [Date, NilClass]
    # @param extended [Date, NilClass]
    def initialize(from:, to: nil, extended: nil)
      @from = from
      @to = to
      @extended = extended
    end

    # @param [Nokogiri::XML::Builder]
    def to_xml(builder)
      builder.commentperiod do
        builder.from from.to_s
        builder.to to.to_s if to
        builder.extended extended.to_s if extended
      end
    end

    # @return [Hash]
    def to_hash
      hash = { "from" => from.to_s }
      hash["to"] = to.to_s if to
      hash["extended"] = extended.to_s if extended
      hash
    end

    # @param prefix [String]
    # @return [String]
    def to_asciibib(prefix)
      pref = prefix.empty? ? prefix : prefix + "."
      pref += "commentperiod"
      out = "#{pref}.from:: #{from}\n"
      out += "#{pref}.to:: #{to}\n" if to
      out += "#{pref}.extended:: #{extended}\n" if extended
      out
    end
  end
end

Version data entries

64 entries across 64 versions & 1 rubygems

Version Path
relaton-nist-1.20.0 lib/relaton_nist/comment_period.rb
relaton-nist-1.19.7 lib/relaton_nist/comment_period.rb
relaton-nist-1.19.6 lib/relaton_nist/comment_period.rb
relaton-nist-1.19.5 lib/relaton_nist/comment_period.rb
relaton-nist-1.19.4 lib/relaton_nist/comment_period.rb
relaton-nist-1.19.3 lib/relaton_nist/comment_period.rb
relaton-nist-1.19.1 lib/relaton_nist/comment_period.rb
relaton-nist-1.19.0 lib/relaton_nist/comment_period.rb
relaton-nist-1.18.0 lib/relaton_nist/comment_period.rb
relaton-nist-1.17.0 lib/relaton_nist/comment_period.rb
relaton-nist-1.16.4 lib/relaton_nist/comment_period.rb
relaton-nist-1.16.3 lib/relaton_nist/comment_period.rb
relaton-nist-1.16.2 lib/relaton_nist/comment_period.rb
relaton-nist-1.16.1 lib/relaton_nist/comment_period.rb
relaton-nist-1.16.0 lib/relaton_nist/comment_period.rb
relaton-nist-1.14.9 lib/relaton_nist/comment_period.rb
relaton-nist-1.14.8 lib/relaton_nist/comment_period.rb
relaton-nist-1.14.7 lib/relaton_nist/comment_period.rb
relaton-nist-1.14.6 lib/relaton_nist/comment_period.rb
relaton-nist-1.14.5 lib/relaton_nist/comment_period.rb