Sha256: 1e10f05900b12dc58e6c4abde8d7aa276c1afb23f16df2beffd670f1294fd8dd
Contents?: true
Size: 1.23 KB
Versions: 4
Compression:
Stored size: 1.23 KB
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 return hash unless type hash = { "content" => hash } if hash.is_a? String hash["type"] = type hash end # @param prefix [String] # @param count [Integer] number of notes # @return [String] def to_asciibib(prefix = "", count = 1) pref = prefix.empty? ? prefix : prefix + "." out = count > 1 ? "#{pref}biblionote::\n" : "" out + "#{pref}biblionote.type:: #{type}\n" if type out += super "#{pref}biblionote" out end end end
Version data entries
4 entries across 4 versions & 1 rubygems