Class: Hydra::Works::CharacterizationService
- Inherits:
-
Object
- Object
- Hydra::Works::CharacterizationService
- Defined in:
- lib/hydra/works/services/characterization_service.rb
Instance Attribute Summary collapse
-
#mapping ⇒ Object
Returns the value of attribute mapping.
-
#object ⇒ Object
Returns the value of attribute object.
-
#parser_class ⇒ Object
Returns the value of attribute parser_class.
-
#source ⇒ Object
Returns the value of attribute source.
-
#tools ⇒ Object
Returns the value of attribute tools.
Class Method Summary collapse
Instance Method Summary collapse
-
#characterize ⇒ Object
Get given source into form that can be passed to Hydra::FileCharacterization Use Hydra::FileCharacterization to extract metadata (an OM XML document) Get the terms (and their values) from the extracted metadata Assign the values of the terms to the properties of the object.
-
#initialize(object, source, options) ⇒ CharacterizationService
constructor
A new instance of CharacterizationService.
Constructor Details
#initialize(object, source, options) ⇒ CharacterizationService
Returns a new instance of CharacterizationService.
15 16 17 18 19 20 21 |
# File 'lib/hydra/works/services/characterization_service.rb', line 15 def initialize(object, source, ) @object = object @source = source @mapping = .fetch(:parser_mapping, Hydra::Works::Characterization.mapper) @parser_class = .fetch(:parser_class, Hydra::Works::Characterization::FitsDocument) @tools = .fetch(:ch12n_tool, :fits) end |
Instance Attribute Details
#mapping ⇒ Object
Returns the value of attribute mapping.
13 14 15 |
# File 'lib/hydra/works/services/characterization_service.rb', line 13 def mapping @mapping end |
#object ⇒ Object
Returns the value of attribute object.
13 14 15 |
# File 'lib/hydra/works/services/characterization_service.rb', line 13 def object @object end |
#parser_class ⇒ Object
Returns the value of attribute parser_class.
13 14 15 |
# File 'lib/hydra/works/services/characterization_service.rb', line 13 def parser_class @parser_class end |
#source ⇒ Object
Returns the value of attribute source.
13 14 15 |
# File 'lib/hydra/works/services/characterization_service.rb', line 13 def source @source end |
#tools ⇒ Object
Returns the value of attribute tools.
13 14 15 |
# File 'lib/hydra/works/services/characterization_service.rb', line 13 def tools @tools end |
Class Method Details
.run(object, source = nil, options = {}) ⇒ Object
9 10 11 |
# File 'lib/hydra/works/services/characterization_service.rb', line 9 def self.run(object, source = nil, = {}) new(object, source, ).characterize end |
Instance Method Details
#characterize ⇒ Object
Get given source into form that can be passed to Hydra::FileCharacterization Use Hydra::FileCharacterization to extract metadata (an OM XML document) Get the terms (and their values) from the extracted metadata Assign the values of the terms to the properties of the object
27 28 29 30 31 32 |
# File 'lib/hydra/works/services/characterization_service.rb', line 27 def characterize content = source_to_content extracted_md = (content) terms = (extracted_md) (terms) end |