Sha256: 843887457e7a0b52408327233ca96e02d5fb8d16de6b1a632aa57c2805a75c0e

Contents?: true

Size: 1.08 KB

Versions: 3

Compression:

Stored size: 1.08 KB

Contents

module GeoConcerns
  module SolrDocumentBehavior
    extend ActiveSupport::Concern
    include CurationConcerns::SolrDocumentBehavior

    # @return [Array<String>]
    def spatial
      fetch(Solrizer.solr_name('spatial'), [])
    end

    # @return [Array<String>]
    def temporal
      fetch(Solrizer.solr_name('temporal'), [])
    end

    # @return [String]
    def issued
      fetch(Solrizer.solr_name('issued'), nil)
    end

    # @return [String]
    def coverage
      fetch(Solrizer.solr_name('coverage'), nil)
    end

    # @return [String]
    def provenance
      name = I18n.t('curation_concerns.institution.name')
      raise ArgumentError, "Provenance required in configuration" unless name.present?
      name
    end

    # @return [DateTime]
    def layer_modified
      # TODO: `date_modified` isn't working correctly -- it's stored as a string not a date
      # @see 'https://github.com/projecthydra/curation_concerns/issues/957'
      dt = first(Solrizer.solr_name('system_modified', :stored_sortable, type: :date))
      dt.nil? ? nil : DateTime.parse(dt).utc
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
geo_concerns-0.0.10 app/models/concerns/geo_concerns/solr_document_behavior.rb
geo_concerns-0.0.9 app/models/concerns/geo_concerns/solr_document_behavior.rb
geo_concerns-0.0.8 app/models/concerns/geo_concerns/solr_document_behavior.rb