class RelatonNist::CommentPeriod

Attributes

extended[R]

@return [Date, NilClass]

from[R]

@return [Date]

to[R]

@rerurn [Date, NilClass]

Public Class Methods

new(from:, to: nil, extended: nil) click to toggle source

@param from [Date] @param to [Date, NilClass] @param extended [Date, NilClass]

# File lib/relaton_nist/comment_period.rb, line 15
def initialize(from:, to: nil, extended: nil)
  @from = from
  @to = to
  @extended = extended
end

Public Instance Methods

to_asciibib(prefix) click to toggle source

@param prefix [String] @return [String]

# File lib/relaton_nist/comment_period.rb, line 40
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
to_hash() click to toggle source

@return [Hash]

# File lib/relaton_nist/comment_period.rb, line 31
def to_hash
  hash = { "from" => from.to_s }
  hash["to"] = to.to_s if to
  hash["extended"] = extended.to_s if extended
  hash
end
to_xml(builder) click to toggle source

@param [Nokogiri::XML::Builder]

# File lib/relaton_nist/comment_period.rb, line 22
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