Class: DataTypes::Int8
- Defined in:
- lib/active_model_serializers_binary/data_types.rb
Instance Attribute Summary
Attributes inherited from BaseType
#bit_length, #count, #length, #name, #parent, #raw_value, #sign, #type, #value
Instance Method Summary collapse
- #dump(value = nil) ⇒ Object
-
#initialize(options = {}) ⇒ Int8
constructor
A new instance of Int8.
- #load(raw_value) ⇒ Object
Methods inherited from BaseType
#after_load, #before_dump, #check, #check_raw_value, #check_value, #size, #to_s, #trim
Constructor Details
#initialize(options = {}) ⇒ Int8
6 7 8 |
# File 'lib/active_model_serializers_binary/data_types.rb', line 6 def initialize( = {}) super .merge :bit_length => 8, :sign => :signed end |
Instance Method Details
#dump(value = nil) ⇒ Object
10 11 12 13 |
# File 'lib/active_model_serializers_binary/data_types.rb', line 10 def dump(value=nil) before_dump( value ).pack('c*').unpack('C*') @raw_value = @value end |
#load(raw_value) ⇒ Object
15 16 17 18 |
# File 'lib/active_model_serializers_binary/data_types.rb', line 15 def load(raw_value) self.value = check_raw_value(raw_value).pack('C*').unpack('c*') after_load end |