Class: CDMDEXER::Transformer
- Inherits:
-
Object
- Object
- CDMDEXER::Transformer
- Defined in:
- lib/cdmdexer/transformer.rb
Instance Attribute Summary collapse
-
#cache_klass ⇒ Object
readonly
Returns the value of attribute cache_klass.
-
#cdm_records ⇒ Object
readonly
Returns the value of attribute cdm_records.
-
#field_mappings ⇒ Object
readonly
Returns the value of attribute field_mappings.
-
#oai_endpoint ⇒ Object
readonly
Returns the value of attribute oai_endpoint.
-
#oai_request_klass ⇒ Object
readonly
Returns the value of attribute oai_request_klass.
-
#record_transformer ⇒ Object
readonly
Returns the value of attribute record_transformer.
Instance Method Summary collapse
-
#initialize(cdm_records: [], oai_endpoint: :MISSING_OAI_ENDPOINT, field_mappings: false, record_transformer: RecordTransformer, cache_klass: ::Rails, oai_request_klass: OaiRequest) ⇒ Transformer
constructor
A new instance of Transformer.
- #records ⇒ Object
Constructor Details
#initialize(cdm_records: [], oai_endpoint: :MISSING_OAI_ENDPOINT, field_mappings: false, record_transformer: RecordTransformer, cache_klass: ::Rails, oai_request_klass: OaiRequest) ⇒ Transformer
Returns a new instance of Transformer.
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/cdmdexer/transformer.rb', line 14 def initialize(cdm_records: [], oai_endpoint: :MISSING_OAI_ENDPOINT, field_mappings: false, record_transformer: RecordTransformer, cache_klass: ::Rails, oai_request_klass: OaiRequest) @cdm_records = cdm_records @oai_endpoint = oai_endpoint @field_mappings = field_mappings ? field_mappings : default_field_mappings @record_transformer = record_transformer @cache_klass = cache_klass @oai_request_klass = oai_request_klass end |
Instance Attribute Details
#cache_klass ⇒ Object (readonly)
Returns the value of attribute cache_klass.
7 8 9 |
# File 'lib/cdmdexer/transformer.rb', line 7 def cache_klass @cache_klass end |
#cdm_records ⇒ Object (readonly)
Returns the value of attribute cdm_records.
7 8 9 |
# File 'lib/cdmdexer/transformer.rb', line 7 def cdm_records @cdm_records end |
#field_mappings ⇒ Object (readonly)
Returns the value of attribute field_mappings.
7 8 9 |
# File 'lib/cdmdexer/transformer.rb', line 7 def field_mappings @field_mappings end |
#oai_endpoint ⇒ Object (readonly)
Returns the value of attribute oai_endpoint.
7 8 9 |
# File 'lib/cdmdexer/transformer.rb', line 7 def oai_endpoint @oai_endpoint end |
#oai_request_klass ⇒ Object (readonly)
Returns the value of attribute oai_request_klass.
7 8 9 |
# File 'lib/cdmdexer/transformer.rb', line 7 def oai_request_klass @oai_request_klass end |
#record_transformer ⇒ Object (readonly)
Returns the value of attribute record_transformer.
7 8 9 |
# File 'lib/cdmdexer/transformer.rb', line 7 def record_transformer @record_transformer end |
Instance Method Details
#records ⇒ Object
28 29 30 |
# File 'lib/cdmdexer/transformer.rb', line 28 def records cdm_records.map { |record| to_solr(record) }.compact end |