Sha256: 81996709ec93089e9abf04a69fbf78147d67ea85c3e4b8472997af6f694d5493

Contents?: true

Size: 792 Bytes

Versions: 7

Compression:

Stored size: 792 Bytes

Contents

module RelatonBib
  class WorkGroup
    # @return [String]
    attr_reader :content

    # @return [Integer, nil]
    attr_reader :number

    # @return [String, nil]
    attr_reader :type

    # @param content [String]
    # @param number [Integer, nil]
    # @param type [String, nil]
    def initialize(content:, number: nil, type: nil)
      @content = content
      @number = number
      @type = type
    end

    # @param builder [Nokogiri::XML::Builder]
    def to_xml(builder)
      builder.text content
      builder.parent[:number] = number if number
      builder.parent[:type] = type if type
    end

    # @return [Hash]
    def to_hash
      hash = { "content" => content }
      hash["number"] = number if number
      hash["type"] = type if type
      hash
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
metanorma-cli-1.3.4 gems/ruby/2.6.0/gems/relaton-bib-1.2.4/lib/relaton_bib/workgroup.rb
metanorma-cli-1.3.3.1 gems/ruby/2.6.0/gems/relaton-bib-1.2.4/lib/relaton_bib/workgroup.rb
relaton-bib-1.2.4 lib/relaton_bib/workgroup.rb
relaton-bib-1.2.2 lib/relaton_bib/workgroup.rb
relaton-bib-1.2.1 lib/relaton_bib/workgroup.rb
relaton-bib-1.2.0 lib/relaton_bib/workgroup.rb
relaton-bib-1.1.1 lib/relaton_bib/workgroup.rb