Sha256: a60670b83ef0e91018b70212d7e01a2a5fdc7c73aa3778a91f8af6310796c489

Contents?: true

Size: 635 Bytes

Versions: 6

Compression:

Stored size: 635 Bytes

Contents

module RelatonIho
  class CommentPeriond
    # @return [Date]
    attr_reader :from

    # @return [Date, NilClass]
    attr_reader :to

    # @param from [String] date
    # @parma to [String, NilClass] date
    def initialize(from:, to: nil)
      @from = Date.parse from
      @to = Date.parse to if to
    end

    # @param builder [Nokogiri::XML::builder]
    def to_xml(builder)
      builder.commentperiod do
        builder.from from.to_s
        builder.to to.to_s if to
      end
    end

    # @return [Hash]
    def to_hash
      hash = { "from" => from.to_s }
      hash["to"] = to.to_s if to
      hash
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
metanorma-cli-1.3.4 gems/ruby/2.6.0/gems/relaton-iho-1.2.3/lib/relaton_iho/comment_periond.rb
metanorma-cli-1.3.3.1 gems/ruby/2.6.0/gems/relaton-iho-1.2.3/lib/relaton_iho/comment_periond.rb
relaton-iho-1.2.3 lib/relaton_iho/comment_periond.rb
relaton-iho-1.2.2 lib/relaton_iho/comment_periond.rb
relaton-iho-1.2.1 lib/relaton_iho/comment_periond.rb
relaton-iho-1.2.0 lib/relaton_iho/comment_periond.rb