Sha256: 6ad320be3cd344fd657542e5618323162a58535741e7f04d15d07bbfca7352ab

Contents?: true

Size: 583 Bytes

Versions: 33

Compression:

Stored size: 583 Bytes

Contents

module RelatonBib
  class Classification
    # @return [String, NilClass]
    attr_reader :type

    # @return [String]
    attr_reader :value

    # @param type [String, NilClass]
    # @param value [String]
    def initialize(type: nil, value:)
      @type  = type
      @value = value
    end

    # @param builder [Nokogiri::XML::Builder]
    def to_xml(builder)
      xml = builder.classification value
      xml[:type] = type if type
    end

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

Version data entries

33 entries across 33 versions & 2 rubygems

Version Path
metanorma-cli-1.3.4 gems/ruby/2.6.0/gems/relaton-bib-1.2.4/lib/relaton_bib/classification.rb
metanorma-cli-1.3.3.1 gems/ruby/2.6.0/gems/relaton-bib-1.2.4/lib/relaton_bib/classification.rb
relaton-bib-1.2.4 lib/relaton_bib/classification.rb
relaton-bib-1.2.2 lib/relaton_bib/classification.rb
relaton-bib-1.2.1 lib/relaton_bib/classification.rb
relaton-bib-1.2.0 lib/relaton_bib/classification.rb
relaton-bib-1.1.1 lib/relaton_bib/classification.rb
relaton-bib-1.1.0 lib/relaton_bib/classification.rb
relaton-bib-1.0.4 lib/relaton_bib/classification.rb
relaton-bib-1.0.3 lib/relaton_bib/classification.rb
relaton-bib-1.0.2 lib/relaton_bib/classification.rb
relaton-bib-1.0.1 lib/relaton_bib/classification.rb
relaton-bib-1.0.0 lib/relaton_bib/classification.rb
relaton-bib-0.9.2 lib/relaton_bib/classification.rb
relaton-bib-0.9.1 lib/relaton_bib/classification.rb
relaton-bib-0.9.0 lib/relaton_bib/classification.rb
relaton-bib-0.8.1 lib/relaton_bib/classification.rb
relaton-bib-0.8.0 lib/relaton_bib/classification.rb
relaton-bib-0.7.0 lib/relaton_bib/classification.rb
relaton-bib-0.6.0 lib/relaton_bib/classification.rb