Sha256: a6d682aefd0625a5020153629cee3c7d6265d0ea2c6e1058e7a35ba3953eeb5c

Contents?: true

Size: 822 Bytes

Versions: 1

Compression:

Stored size: 822 Bytes

Contents

module RelatonBib
  class BiblioNote < FormattedString
    # @return [String, NilClass]
    attr_reader :type

    # @param content [String]
    # @param type [String, NilClass]
    # @param language [String, NilClass] language code Iso639
    # @param script [String, NilClass] script code Iso15924
    # @param format [String, NilClass] the content format
    def initialize(content:, type: nil, language: nil, script: nil, format: nil)
      @type = type
      super content: content, language: language, script: script, format: format
    end

    # @param builder [Nokogiri::XML::Builder]
    def to_xml(builder)
      xml = builder.note { super }
      xml[:type] = type if type
      xml
    end

    # @return [Hash]
    def to_hash
      hash = super
      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/biblio_note.rb