Sha256: c46b36c45ccf997e86278bf66fc5892c23f416ffde2168d580257d6937d39977

Contents?: true

Size: 743 Bytes

Versions: 9

Compression:

Stored size: 743 Bytes

Contents

module RelatonIsoBib
  # Iso ICS classificator.
  class Ics < Isoics::ICS
    # @param code [String, NilClass]
    # @param field [Integer, NilClass]
    # @param group [Integer, NilClass]
    # @param subgroup [Integer, NilClass]
    def initialize(code = nil, field: nil, group: nil, subgroup: nil)
      unless code || field
        raise ArgumentError, "wrong arguments (should be string or { fieldcode: [String] }"
      end

      field, group, subgroup = code.split '.' if code
      super fieldcode: field, groupcode: group, subgroupcode: subgroup
    end

    # @param builder [Nokogiri::XML::Builder]
    def to_xml(builder)
      builder.ics do
        builder.code code
        builder.text_ description
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
relaton-iso-bib-0.3.2 lib/relaton_iso_bib/ics.rb
relaton-iso-bib-0.3.1 lib/relaton_iso_bib/ics.rb
relaton-iso-bib-0.3.0 lib/relaton_iso_bib/ics.rb
relaton-iso-bib-0.2.4 lib/relaton_iso_bib/ics.rb
relaton-iso-bib-0.2.3 lib/relaton_iso_bib/ics.rb
relaton-iso-bib-0.2.2 lib/relaton_iso_bib/ics.rb
relaton-iso-bib-0.2.1 lib/relaton_iso_bib/ics.rb
relaton-iso-bib-0.2.0 lib/relaton_iso_bib/ics.rb
relaton-iso-bib-0.1.0 lib/relaton_iso_bib/ics.rb