Class: DataTypes::UInt8

Inherits:
BaseType show all
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

Methods inherited from BaseType

#after_load, #before_dump, #check, #check_raw_value, #check_value, #size, #to_s, #trim

Constructor Details

#initialize(options = {}) ⇒ UInt8

Returns a new instance of UInt8.



87
88
89
# File 'lib/active_model_serializers_binary/data_types.rb', line 87

def initialize(options = {})
  super options.merge :bit_length => 8, :sign => :unsigned
end

Instance Method Details

#dump(value = nil) ⇒ Object



91
92
93
94
# File 'lib/active_model_serializers_binary/data_types.rb', line 91

def dump(value=nil)
  before_dump( value )
  @raw_value = @value
end

#load(raw_value) ⇒ Object



96
97
98
99
# File 'lib/active_model_serializers_binary/data_types.rb', line 96

def load(raw_value)
  self.value = check_raw_value(raw_value)
  after_load
end