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.
16 17 18 19 20 21 22 |
# File 'lib/hydra/works/services/characterization_service.rb', line 16 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.
14 15 16 |
# File 'lib/hydra/works/services/characterization_service.rb', line 14 def mapping @mapping end |
#object ⇒ Object
Returns the value of attribute object.
14 15 16 |
# File 'lib/hydra/works/services/characterization_service.rb', line 14 def object @object end |
#parser_class ⇒ Object
Returns the value of attribute parser_class.
14 15 16 |
# File 'lib/hydra/works/services/characterization_service.rb', line 14 def parser_class @parser_class end |
#source ⇒ Object
Returns the value of attribute source.
14 15 16 |
# File 'lib/hydra/works/services/characterization_service.rb', line 14 def source @source end |
#tools ⇒ Object
Returns the value of attribute tools.
14 15 16 |
# File 'lib/hydra/works/services/characterization_service.rb', line 14 def tools @tools end |
Class Method Details
.run(object, source = nil, options = {}) ⇒ Object
10 11 12 |
# File 'lib/hydra/works/services/characterization_service.rb', line 10 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
28 29 30 31 32 33 |
# File 'lib/hydra/works/services/characterization_service.rb', line 28 def characterize content = source_to_content extracted_md = (content) terms = (extracted_md) (terms) end |