Sha256: c5d2b346fc32c34aa45f6ec194e1bd25600212ad08efb3e9aaf9e62bbcab77de

Contents?: true

Size: 578 Bytes

Versions: 1

Compression:

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

1 entries across 1 versions & 1 rubygems

Version Path
relaton-bib-0.3.4 lib/relaton_bib/classification.rb