Sha256: ccb2ccf8fadeec0ef44c49f0e2fe66295d67f2a99041f032b5015e600ed6a65a

Contents?: true

Size: 744 Bytes

Versions: 4

Compression:

Stored size: 744 Bytes

Contents

# frozen_string_literal: true

require_relative "extract_language"
require_relative "core"

module Termium
  # For <extract>
  class Extract < Shale::Mapper
    attribute :language, Shale::Type::String
    attribute :extract_language, ExtractLanguage, collection: true
    attribute :core, Core, collection: true

    xml do
      root "termium_extract"
      # namespace 'http://termium.tpsgc-pwgsc.gc.ca/schemas/2012/06/Termium', 'ns2'

      map_attribute "language", to: :language
      map_element "extractLanguage", to: :extract_language
      map_element "core", to: :core
    end

    def to_concept
      coll = Glossarist::ManagedConceptCollection.new
      coll.managed_concepts = core.map(&:to_concept)
      coll
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
termium-0.1.4 lib/termium/extract.rb
termium-0.1.2 lib/termium/extract.rb
termium-0.1.1 lib/termium/extract.rb
termium-0.1.0 lib/termium/extract.rb