Method: Avro::LogicalTypes::BytesDecimal#encode
- Defined in:
- lib/avro/logical_types.rb
#encode(value) ⇒ Object
Encode the provided value into a byte array
119 120 121 122 123 |
# File 'lib/avro/logical_types.rb', line 119 def encode(value) raise ArgumentError, ERROR_VALUE_MUST_BE_NUMERIC unless value.is_a?(Numeric) to_byte_array(unscaled_value(value.to_d)).pack(PACK_UNSIGNED_CHARS).freeze end |