Class: RelatonNist::CommentPeriod
- Inherits:
-
Object
- Object
- RelatonNist::CommentPeriod
- Defined in:
- lib/relaton_nist/comment_period.rb
Instance Attribute Summary collapse
- #extended ⇒ Date, NilClass readonly
- #from ⇒ Date readonly
-
#to ⇒ Object
readonly
Returns the value of attribute to.
Instance Method Summary collapse
-
#initialize(from:, to: nil, extended: nil) ⇒ CommentPeriod
constructor
A new instance of CommentPeriod.
- #to_asciibib(prefix) ⇒ String
- #to_hash ⇒ Hash
- #to_xml(builder) ⇒ Object
Constructor Details
#initialize(from:, to: nil, extended: nil) ⇒ CommentPeriod
Returns a new instance of CommentPeriod.
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
#extended ⇒ Date, NilClass (readonly)
10 11 12 |
# File 'lib/relaton_nist/comment_period.rb', line 10 def extended @extended end |
#from ⇒ Date (readonly)
4 5 6 |
# File 'lib/relaton_nist/comment_period.rb', line 4 def from @from end |
#to ⇒ Object (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
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_hash ⇒ 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
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 |