Class: DBF::ColumnType::Memo
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#blank_value, #initialize, #skip_blank?
Constructor Details
This class inherits a constructor from DBF::ColumnType::Base
Instance Method Details
#decode(raw, &memo_handler) ⇒ Object
122 123 124 125 |
# File 'lib/dbf/column_type.rb', line 122 def decode(raw, &memo_handler) memo_content = memo_handler.call(raw) memo_content ? type_cast(memo_content) : nil end |
#type_cast(value) ⇒ Object
128 129 130 131 132 |
# File 'lib/dbf/column_type.rb', line 128 def type_cast(value) return value unless encoding && value value.dup.force_encoding(encoding).encode(Encoding.default_external, undef: :replace, invalid: :replace) end |