Class: ROF::Translators::FedoraToRof
- Inherits:
-
ROF::Translator
- Object
- ROF::Translator
- ROF::Translators::FedoraToRof
- Defined in:
- lib/rof/translators/fedora_to_rof.rb
Overview
Responsible for translating Fedora PIDs to ROF objects
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#fedora_connection_information ⇒ Object
readonly
Returns the value of attribute fedora_connection_information.
-
#pids ⇒ Object
readonly
Returns the value of attribute pids.
Class Method Summary collapse
-
.call(pids, config = {}) ⇒ Hash
The ROF representation of teh Fedora objects.
Instance Method Summary collapse
-
#initialize(pids, config = {}) ⇒ FedoraToRof
constructor
A new instance of FedoraToRof.
- #to_rof ⇒ Object
Constructor Details
#initialize(pids, config = {}) ⇒ FedoraToRof
Returns a new instance of FedoraToRof.
21 22 23 24 25 26 |
# File 'lib/rof/translators/fedora_to_rof.rb', line 21 def initialize(pids, config = {}) @pids = pids @fedora_connection_information = config.fetch(:fedora_connection_information) @config = config connect_to_fedora! end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
27 28 29 |
# File 'lib/rof/translators/fedora_to_rof.rb', line 27 def config @config end |
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
27 28 29 |
# File 'lib/rof/translators/fedora_to_rof.rb', line 27 def connection @connection end |
#fedora_connection_information ⇒ Object (readonly)
Returns the value of attribute fedora_connection_information.
27 28 29 |
# File 'lib/rof/translators/fedora_to_rof.rb', line 27 def fedora_connection_information @fedora_connection_information end |
#pids ⇒ Object (readonly)
Returns the value of attribute pids.
27 28 29 |
# File 'lib/rof/translators/fedora_to_rof.rb', line 27 def pids @pids end |
Class Method Details
.call(pids, config = {}) ⇒ Hash
Returns The ROF representation of teh Fedora objects.
17 18 19 |
# File 'lib/rof/translators/fedora_to_rof.rb', line 17 def self.call(pids, config = {}) new(pids, config).to_rof end |
Instance Method Details
#to_rof ⇒ Object
37 38 39 40 41 42 |
# File 'lib/rof/translators/fedora_to_rof.rb', line 37 def to_rof # wrap the objects inside a JSON list pids.map do |pid| PidToRofElement.new(pid, connection, config).convert end end |