Sha256: 168a88dfd71d4a831173a1e6afd40c255022d09d2cdc097ed9e9baa66e84c41d

Contents?: true

Size: 1.83 KB

Versions: 3

Compression:

Stored size: 1.83 KB

Contents

# frozen_string_literal: true

require_relative "base_mapper"

require_relative "area"
require_relative "city_section"
require_relative "hierarchical_part"
require_relative "region"

module LocMods
  class HierarchicalGeographic < BaseMapper
    attribute :authority, Shale::Type::String
    attribute :authority_uri, Shale::Type::Value
    attribute :value_uri, Shale::Type::Value
    attribute :extra_terrestrial_area, HierarchicalPart, collection: true
    attribute :continent, HierarchicalPart, collection: true
    attribute :country, HierarchicalPart, collection: true
    attribute :province, Shale::Type::String, collection: true
    attribute :region, Region, collection: true
    attribute :state, HierarchicalPart, collection: true
    attribute :territory, HierarchicalPart, collection: true
    attribute :county, HierarchicalPart, collection: true
    attribute :city, HierarchicalPart, collection: true
    attribute :city_section, CitySection, collection: true
    attribute :island, HierarchicalPart, collection: true
    attribute :area, Area, collection: true

    xml do
      root "hierarchicalGeographic"
      namespace "http://www.loc.gov/mods/v3", nil

      map_attribute "authority", to: :authority
      map_attribute "authorityURI", to: :authority_uri
      map_attribute "valueURI", to: :value_uri
      map_element "extraTerrestrialArea", to: :extra_terrestrial_area
      map_element "continent", to: :continent
      map_element "country", to: :country
      map_element "province", to: :province
      map_element "region", to: :region
      map_element "state", to: :state
      map_element "territory", to: :territory
      map_element "county", to: :county
      map_element "city", to: :city
      map_element "citySection", to: :city_section
      map_element "island", to: :island
      map_element "area", to: :area
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
loc_mods-0.2.4 lib/loc_mods/hierarchical_geographic.rb
loc_mods-0.2.3 lib/loc_mods/hierarchical_geographic.rb
loc_mods-0.2.2 lib/loc_mods/hierarchical_geographic.rb