Class: ASpaceImport::CSVConvert::CellHandler
- Inherits:
-
Object
- Object
- ASpaceImport::CSVConvert::CellHandler
- Defined in:
- backend/app/converters/lib/csv_converter.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#target_key ⇒ Object
readonly
Returns the value of attribute target_key.
-
#target_path ⇒ Object
readonly
Returns the value of attribute target_path.
Instance Method Summary collapse
-
#extract_value(cell_contents) ⇒ Object
-
#initialize(name, data_path, val_filter = nil) ⇒ CellHandler
constructor
A new instance of CellHandler.
Constructor Details
#initialize(name, data_path, val_filter = nil) ⇒ CellHandler
Returns a new instance of CellHandler.
150 151 152 153 154 |
# File 'backend/app/converters/lib/csv_converter.rb', line 150 def initialize(name, data_path, val_filter = nil) @name = name @target_key, @target_path = data_path.split(".") @val_filter = val_filter end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name
146 147 148 |
# File 'backend/app/converters/lib/csv_converter.rb', line 146 def name @name end |
#target_key ⇒ Object (readonly)
Returns the value of attribute target_key
147 148 149 |
# File 'backend/app/converters/lib/csv_converter.rb', line 147 def target_key @target_key end |
#target_path ⇒ Object (readonly)
Returns the value of attribute target_path
148 149 150 |
# File 'backend/app/converters/lib/csv_converter.rb', line 148 def target_path @target_path end |
Instance Method Details
#extract_value(cell_contents) ⇒ Object
157 158 159 160 |
# File 'backend/app/converters/lib/csv_converter.rb', line 157 def extract_value(cell_contents) return nil if cell_contents.nil? || cell_contents == 'NULL' @val_filter ? @val_filter.call(cell_contents) : cell_contents end |