class ROF::Translators::JsonldToRof::PredicateHandler::UrlHandler::ExplicitLocationSlugHandler

@api private

Attributes

slug[R]

Public Class Methods

new(url_handler, slug, options) click to toggle source
# File lib/rof/translators/jsonld_to_rof/predicate_handler.rb, line 224
def initialize(url_handler, slug, options)
  @url_handler = url_handler
  @slug = slug
  @options = options
end

Public Instance Methods

call(object, accumulator, blank_node) click to toggle source
# File lib/rof/translators/jsonld_to_rof/predicate_handler.rb, line 231
def call(object, accumulator, blank_node)
  to = @options.fetch(:to)
  multiple = @options.fetch(:multiple, true)
  unless force?
    to = @url_handler.within + Array.wrap(to)
    to[-1] = "#{@url_handler.namespace_prefix}#{to[-1]}"
  end
  accumulator.add_predicate_location_and_value(to, object, blank_node: blank_node, multiple: multiple)
end
force?() click to toggle source
# File lib/rof/translators/jsonld_to_rof/predicate_handler.rb, line 241
def force?
  @options.fetch(:force, false)
end