Class: Hydra::ContentNegotiation::CleanGraphRepository

Inherits:
Object
  • Object
show all
Defined in:
app/models/hydra/content_negotiation/clean_graph_repository.rb

Overview

CleanGraphRepository has a #find interface which returns a graph for use with content negotiation.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connection, replacer = Hydra.config.id_to_resource_uri) ⇒ CleanGraphRepository

Returns a new instance of CleanGraphRepository.

Parameters:

  • connection (#get)

    the connection to fedora

  • replacer (#call) (defaults to: Hydra.config.id_to_resource_uri)

    a function that is called with id and graph and returns a string representation of the new uri.



8
9
10
11
# File 'app/models/hydra/content_negotiation/clean_graph_repository.rb', line 8

def initialize(connection, replacer = Hydra.config.id_to_resource_uri)
  @connection = connection
  @replacer = replacer
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



5
6
7
# File 'app/models/hydra/content_negotiation/clean_graph_repository.rb', line 5

def connection
  @connection
end

#replacerObject (readonly)

Returns the value of attribute replacer.



5
6
7
# File 'app/models/hydra/content_negotiation/clean_graph_repository.rb', line 5

def replacer
  @replacer
end

Instance Method Details

#find(id) ⇒ Object



13
14
15
16
17
18
# File 'app/models/hydra/content_negotiation/clean_graph_repository.rb', line 13

def find(id)
  ReplacingGraphFinder.new(
    GraphFinder.new(connection, id),
    replacer
  ).graph
end