Class: RelatonNist::CommentPeriod

Inherits:
Object
  • Object
show all
Defined in:
lib/relaton_nist/comment_period.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(from:, to: nil, extended: nil) ⇒ CommentPeriod

Returns a new instance of CommentPeriod.

Parameters:

  • from (Date)
  • to (Date, NilClass) (defaults to: nil)
  • extended (Date, NilClass) (defaults to: nil)


15
16
17
18
19
# File 'lib/relaton_nist/comment_period.rb', line 15

def initialize(from:, to: nil, extended: nil)
  @from = from
  @to = to
  @extended = extended
end

Instance Attribute Details

#extendedDate, NilClass (readonly)

Returns:

  • (Date, NilClass)


10
11
12
# File 'lib/relaton_nist/comment_period.rb', line 10

def extended
  @extended
end

#fromDate (readonly)

Returns:

  • (Date)


4
5
6
# File 'lib/relaton_nist/comment_period.rb', line 4

def from
  @from
end

#toObject (readonly)

Returns the value of attribute to.



7
8
9
# File 'lib/relaton_nist/comment_period.rb', line 7

def to
  @to
end

Instance Method Details

#to_asciibib(prefix) ⇒ String

Parameters:

  • prefix (String)

Returns:

  • (String)


40
41
42
43
44
45
46
47
# 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_hashHash

Returns:

  • (Hash)


31
32
33
34
35
36
# 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) ⇒ Object

Parameters:

  • (Nokogiri::XML::Builder)


22
23
24
25
26
27
28
# 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