Sha256: 0a453e4b5c11d28f58286b8b0c42dd8ef99d30bd9e57289f3c8a3d0b0d80bb90

Contents?: true

Size: 896 Bytes

Versions: 31

Compression:

Stored size: 896 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

    # @param prefix [String]
    # @return [String]
    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
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
relaton-iho-1.19.1 lib/relaton_iho/comment_periond.rb
relaton-iho-1.19.0 lib/relaton_iho/comment_periond.rb
relaton-iho-1.18.0 lib/relaton_iho/comment_periond.rb
relaton-iho-1.17.0 lib/relaton_iho/comment_periond.rb
relaton-iho-1.16.2 lib/relaton_iho/comment_periond.rb
relaton-iho-1.16.1 lib/relaton_iho/comment_periond.rb
relaton-iho-1.16.0 lib/relaton_iho/comment_periond.rb
relaton-iho-1.14.3 lib/relaton_iho/comment_periond.rb
relaton-iho-1.14.2 lib/relaton_iho/comment_periond.rb
relaton-iho-1.14.1 lib/relaton_iho/comment_periond.rb
relaton-iho-1.14.0 lib/relaton_iho/comment_periond.rb
relaton-iho-1.13.0 lib/relaton_iho/comment_periond.rb
relaton-iho-1.12.1 lib/relaton_iho/comment_periond.rb
relaton-iho-1.12.0 lib/relaton_iho/comment_periond.rb
relaton-iho-1.11.0 lib/relaton_iho/comment_periond.rb
relaton-iho-1.10.2 lib/relaton_iho/comment_periond.rb
relaton-iho-1.10.1 lib/relaton_iho/comment_periond.rb
relaton-iho-1.10.0 lib/relaton_iho/comment_periond.rb
relaton-iho-1.9.0 lib/relaton_iho/comment_periond.rb
relaton-iho-1.8.0 lib/relaton_iho/comment_periond.rb