Class: CDMBL::Transformer
- Inherits:
-
Object
- Object
- CDMBL::Transformer
- Defined in:
- lib/cdmbl/transformer.rb
Instance Attribute Summary collapse
-
#cdm_records ⇒ Object
readonly
Returns the value of attribute cdm_records.
-
#extract_compounds ⇒ Object
readonly
Returns the value of attribute extract_compounds.
-
#field_mappings ⇒ Object
readonly
Returns the value of attribute field_mappings.
-
#oai_sets ⇒ Object
readonly
Returns the value of attribute oai_sets.
-
#record_transformer ⇒ Object
readonly
Returns the value of attribute record_transformer.
Instance Method Summary collapse
-
#initialize(cdm_records: [], oai_sets: {}, field_mappings: false, extract_compounds: false, record_transformer: RecordTransformer) ⇒ Transformer
constructor
A new instance of Transformer.
- #records ⇒ Object
Constructor Details
#initialize(cdm_records: [], oai_sets: {}, field_mappings: false, extract_compounds: false, record_transformer: RecordTransformer) ⇒ Transformer
Returns a new instance of Transformer.
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/cdmbl/transformer.rb', line 11 def initialize(cdm_records: [], oai_sets: {}, field_mappings: false, extract_compounds: false, record_transformer: RecordTransformer) @cdm_records = cdm_records.map do |record| record.merge('record_type' => 'primary') end @oai_sets = oai_sets @field_mappings = field_mappings ? field_mappings : default_field_mappings @extract_compounds = extract_compounds @record_transformer = record_transformer end |
Instance Attribute Details
#cdm_records ⇒ Object (readonly)
Returns the value of attribute cdm_records.
6 7 8 |
# File 'lib/cdmbl/transformer.rb', line 6 def cdm_records @cdm_records end |
#extract_compounds ⇒ Object (readonly)
Returns the value of attribute extract_compounds.
6 7 8 |
# File 'lib/cdmbl/transformer.rb', line 6 def extract_compounds @extract_compounds end |
#field_mappings ⇒ Object (readonly)
Returns the value of attribute field_mappings.
6 7 8 |
# File 'lib/cdmbl/transformer.rb', line 6 def field_mappings @field_mappings end |
#oai_sets ⇒ Object (readonly)
Returns the value of attribute oai_sets.
6 7 8 |
# File 'lib/cdmbl/transformer.rb', line 6 def oai_sets @oai_sets end |
#record_transformer ⇒ Object (readonly)
Returns the value of attribute record_transformer.
6 7 8 |
# File 'lib/cdmbl/transformer.rb', line 6 def record_transformer @record_transformer end |
Instance Method Details
#records ⇒ Object
25 26 27 |
# File 'lib/cdmbl/transformer.rb', line 25 def records raw_records.map { |record| to_solr(record) }.compact end |