Module: BerkeleyLibrary::TIND::Mapping::CsvMapper
- Included in:
- DataFieldsCatalog, TindFieldFromSingleMap, TindMarc
- Defined in:
- lib/berkeley_library/tind/mapping/csv_mapper.rb
Class Attribute Summary collapse
-
.rows ⇒ Object
Returns the value of attribute rows.
Instance Method Summary collapse
- #from_tags ⇒ Object
-
#one_occurrence_tags ⇒ Object
tags allow to keep the first datafield from original marc record.
- #rules ⇒ Object
Class Attribute Details
.rows ⇒ Object
Returns the value of attribute rows.
10 11 12 |
# File 'lib/berkeley_library/tind/mapping/csv_mapper.rb', line 10 def rows @rows end |
Instance Method Details
#from_tags ⇒ Object
15 16 17 |
# File 'lib/berkeley_library/tind/mapping/csv_mapper.rb', line 15 def CsvMapper.rows.map { |row| row[:tag_origin] }.compact end |
#one_occurrence_tags ⇒ Object
tags allow to keep the first datafield from original marc record
24 25 26 27 28 29 30 |
# File 'lib/berkeley_library/tind/mapping/csv_mapper.rb', line 24 def = [] CsvMapper.rows.each do |row| << row[:tag_origin] if row[:keep_one_if_multiple_available] end .compact end |
#rules ⇒ Object
19 20 21 |
# File 'lib/berkeley_library/tind/mapping/csv_mapper.rb', line 19 def rules CsvMapper.rows.to_h { |row| ["tag_#{row[:tag_origin]}".to_sym, SingleRule.new(row)] } end |