Class: RelatonIho::CommentPeriond
- Inherits:
-
Object
- Object
- RelatonIho::CommentPeriond
- Defined in:
- lib/relaton_iho/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_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_iho/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_iho/comment_periond.rb', line 4 def from @from end |
#to ⇒ Date, NilClass (readonly)
7 8 9 |
# File 'lib/relaton_iho/comment_periond.rb', line 7 def to @to end |
Instance Method Details
#to_hash ⇒ Hash
25 26 27 28 29 |
# File 'lib/relaton_iho/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_iho/comment_periond.rb', line 17 def to_xml(builder) builder.commentperiod do builder.from from.to_s builder.to to.to_s if to end end |