Class: Mongo::Binary
- Inherits:
-
ByteBuffer
- Object
- ByteBuffer
- Mongo::Binary
- Defined in:
- lib/mongo/types/binary.rb
Overview
An array of binary bytes with a MongoDB subtype. See the subtype constants for reference.
Use this class when storing binary data in documents.
Constant Summary collapse
- SUBTYPE_BYTES =
0x02
- SUBTYPE_UUID =
0x03
- SUBTYPE_MD5 =
0x05
- SUBTYPE_USER_DEFINED =
0x80
Constants inherited from ByteBuffer
Instance Attribute Summary collapse
-
#subtype ⇒ Object
One of the SUBTYPE_* constants.
Attributes inherited from ByteBuffer
Instance Method Summary collapse
-
#initialize(initial_data = [], subtype = SUBTYPE_BYTES) ⇒ Binary
constructor
Create a buffer for storing binary data in MongoDB.
- #inspect ⇒ Object
Methods inherited from ByteBuffer
#append!, #clear, #dump, #get, #get_double, #get_int, #get_long, #more?, #position, #position=, #prepend!, #put, #put_array, #put_double, #put_int, #put_long, #rewind, serialize_cstr, #size, #to_a, #to_s, to_utf8, #unpack
Constructor Details
#initialize(initial_data = [], subtype = SUBTYPE_BYTES) ⇒ Binary
Create a buffer for storing binary data in MongoDB.
42 43 44 45 |
# File 'lib/mongo/types/binary.rb', line 42 def initialize(initial_data=[], subtype=SUBTYPE_BYTES) super(initial_data) @subtype = subtype end |
Instance Attribute Details
#subtype ⇒ Object
One of the SUBTYPE_* constants. Default is SUBTYPE_BYTES.
33 34 35 |
# File 'lib/mongo/types/binary.rb', line 33 def subtype @subtype end |
Instance Method Details
#inspect ⇒ Object
47 48 49 |
# File 'lib/mongo/types/binary.rb', line 47 def inspect "<Mongo::Binary:#{object_id}>" end |