Class: RelatonBipm::CommentPeriond
- Inherits:
-
Object
- Object
- RelatonBipm::CommentPeriond
- Defined in:
- lib/relaton_bipm/comment_periond.rb
Instance Attribute Summary collapse
- #from ⇒ Date readonly
- #to ⇒ Date, NilClass readonly
Instance Method Summary collapse
-
#initialize(from:, to: nil) ⇒ CommentPeriond
constructor
A new instance of CommentPeriond.
- #to_asciibib(prefix) ⇒ String
- #to_hash ⇒ Hash
- #to_xml(builder) ⇒ Object
Constructor Details
#initialize(from:, to: nil) ⇒ CommentPeriond
Returns a new instance of CommentPeriond.
11 12 13 14 |
# File 'lib/relaton_bipm/comment_periond.rb', line 11 def initialize(from:, to: nil) @from = Date.parse from @to = Date.parse to if to end |
Instance Attribute Details
#from ⇒ Date (readonly)
4 5 6 |
# File 'lib/relaton_bipm/comment_periond.rb', line 4 def from @from end |
#to ⇒ Date, NilClass (readonly)
7 8 9 |
# File 'lib/relaton_bipm/comment_periond.rb', line 7 def to @to end |
Instance Method Details
#to_asciibib(prefix) ⇒ String
33 34 35 36 37 38 39 |
# File 'lib/relaton_bipm/comment_periond.rb', line 33 def to_asciibib(prefix) pref = prefix.empty? ? prefix : "#{prefix}." pref += "commentperiod" out = "#{pref}.from:: #{from}\n" out += "#{pref}.to:: #{to}\n" if to out end |
#to_hash ⇒ Hash
25 26 27 28 29 |
# File 'lib/relaton_bipm/comment_periond.rb', line 25 def to_hash hash = { "from" => from.to_s } hash["to"] = to.to_s if to hash end |
#to_xml(builder) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/relaton_bipm/comment_periond.rb', line 17 def to_xml(builder) builder.send :"comment-period" do builder.from from.to_s builder.to to.to_s if to end end |