Sha256: 2a9301ea2d27d1dc0e72033eea67b44688184ad5140edfc005f98dc16c6c39cc

Contents?: true

Size: 575 Bytes

Versions: 5

Compression:

Stored size: 575 Bytes

Contents

module GeoConcerns
  module Discovery
    class DocumentBuilder
      class SlugBuilder
        attr_reader :geo_concern

        def initialize(geo_concern)
          @geo_concern = geo_concern
        end

        def build(document)
          document.slug = slug
        end

        # Returns the document slug for use in discovery systems.
        # @return [String] document slug
        def slug
          return geo_concern.id unless geo_concern.provenance
          "#{geo_concern.provenance.parameterize}-#{geo_concern.id}"
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
geo_concerns-0.3.4 app/services/geo_concerns/discovery/document_builder/slug_builder.rb
geo_concerns-0.3.3 app/services/geo_concerns/discovery/document_builder/slug_builder.rb
geo_concerns-0.3.2 app/services/geo_concerns/discovery/document_builder/slug_builder.rb
geo_concerns-0.3.1 app/services/geo_concerns/discovery/document_builder/slug_builder.rb
geo_concerns-0.3.0 app/services/geo_concerns/discovery/document_builder/slug_builder.rb