Class: GalterIrExporter::Export::Actor
- Inherits:
-
Object
- Object
- GalterIrExporter::Export::Actor
- Defined in:
- lib/galter_ir_exporter/export/actor.rb
Overview
Convert a GenericFile including metadata, permissions and version metadata into a PORO so that the metadata can be exported in json format using to_json
Instance Attribute Summary collapse
-
#conversion_count ⇒ Object
Returns the value of attribute conversion_count.
-
#converter_registry ⇒ Object
readonly
Returns the value of attribute converter_registry.
-
#ids ⇒ Object
readonly
Returns the value of attribute ids.
-
#limit ⇒ Object
readonly
Returns the value of attribute limit.
Instance Method Summary collapse
-
#call(model_class_list = converter_registry.keys, opts = {}) ⇒ Object
Convert the classes using the registered converters from ActiveFedora to json files.
-
#initialize ⇒ Actor
constructor
initialize the class with the default registry.
-
#register_converter(model_class, converter_class) ⇒ Object
register a converter for a new class or overwrite the converter for a default class.
Constructor Details
#initialize ⇒ Actor
initialize the class with the default registry
11 12 13 |
# File 'lib/galter_ir_exporter/export/actor.rb', line 11 def initialize @converter_registry = default_registry end |
Instance Attribute Details
#conversion_count ⇒ Object
Returns the value of attribute conversion_count.
8 9 10 |
# File 'lib/galter_ir_exporter/export/actor.rb', line 8 def conversion_count @conversion_count end |
#converter_registry ⇒ Object (readonly)
Returns the value of attribute converter_registry.
7 8 9 |
# File 'lib/galter_ir_exporter/export/actor.rb', line 7 def converter_registry @converter_registry end |
#ids ⇒ Object (readonly)
Returns the value of attribute ids.
7 8 9 |
# File 'lib/galter_ir_exporter/export/actor.rb', line 7 def ids @ids end |
#limit ⇒ Object (readonly)
Returns the value of attribute limit.
7 8 9 |
# File 'lib/galter_ir_exporter/export/actor.rb', line 7 def limit @limit end |
Instance Method Details
#call(model_class_list = converter_registry.keys, opts = {}) ⇒ Object
Convert the classes using the registered converters from ActiveFedora to json files
31 32 33 34 35 36 |
# File 'lib/galter_ir_exporter/export/actor.rb', line 31 def call(model_class_list = converter_registry.keys, opts = {}) @conversion_count = 0 validate_class_list(model_class_list) (opts) export_models(model_class_list) end |
#register_converter(model_class, converter_class) ⇒ Object
register a converter for a new class or overwrite the converter for a default class
19 20 21 22 23 |
# File 'lib/galter_ir_exporter/export/actor.rb', line 19 def register_converter(model_class, converter_class) raise(RegistryError, "Model (#{model_class.name}) for conversion must be an ActiveFedora::Base") unless model_class.ancestors.include?(ActiveFedora::Base) raise(RegistryError, "Converter (#{converter_class.name}) for conversion must be an GalterIrExporter::Export::Converter") unless converter_class.ancestors.include?(GalterIrExporter::Export::Converter) converter_registry[model_class] = converter_class end |