Class: DataTypes::UInt32
- Defined in:
- lib/active_model_serializers_binary/data_types.rb
Instance Attribute Summary
Attributes inherited from Type
#bit_length, #count, #length, #name, #parent, #raw_value, #sign, #type, #value
Instance Method Summary collapse
- #dump(value = nil) ⇒ Object
-
#initialize(options = {}) ⇒ UInt32
constructor
A new instance of UInt32.
- #load(raw_value) ⇒ Object
Methods inherited from Type
#after_load, #before_dump, #check, #check_raw_value, #check_value, #size, #to_s, #trim
Constructor Details
#initialize(options = {}) ⇒ UInt32
Returns a new instance of UInt32.
71 72 73 |
# File 'lib/active_model_serializers_binary/data_types.rb', line 71 def initialize( = {}) super .merge :bit_length => 32, :sign => :unsigned end |
Instance Method Details
#dump(value = nil) ⇒ Object
75 76 77 78 |
# File 'lib/active_model_serializers_binary/data_types.rb', line 75 def dump(value=nil) before_dump( value ) @raw_value = @value.pack('l*').unpack('C*') end |
#load(raw_value) ⇒ Object
80 81 82 83 |
# File 'lib/active_model_serializers_binary/data_types.rb', line 80 def load(raw_value) self.value = check_raw_value(raw_value).pack('C*').unpack('l*') if !value.nil? after_load end |