Class: Erlang::ETF::Binary
- Inherits:
-
Object
- Object
- Erlang::ETF::Binary
- Includes:
- Term
- Defined in:
- lib/erlang/etf/binary.rb
Overview
1 | 4 | Len |
---|---|---|
109 | Len | Data |
Binaries are generated with bit syntax expression or with
list_to_binary/1
, term_to_binary/1
, or as input from
binary ports.
The Len
length field is an unsigned 4 byte integer (big endian).
(see BINARY_EXT
)
Constant Summary
Constants included from Term
Term::BERT_PREFIX, Term::BIN_LSB_PACK, Term::BIN_MSB_PACK
Instance Method Summary collapse
- #__ruby_evolve__ ⇒ Object
- #deserialize_data(buffer) ⇒ Object
-
#initialize(data) ⇒ Binary
constructor
A new instance of Binary.
- #serialize_data(buffer) ⇒ Object
Methods included from Term
#==, #__erlang_evolve__, #__erlang_type__, included
Constructor Details
#initialize(data) ⇒ Binary
Returns a new instance of Binary.
42 43 44 |
# File 'lib/erlang/etf/binary.rb', line 42 def initialize(data) @data = data end |
Instance Method Details
#__ruby_evolve__ ⇒ Object
46 47 48 |
# File 'lib/erlang/etf/binary.rb', line 46 def __ruby_evolve__ data end |
#deserialize_data(buffer) ⇒ Object
31 32 33 |
# File 'lib/erlang/etf/binary.rb', line 31 def deserialize_data(buffer) self.data = buffer.read(len).from_utf8_binary end |
#serialize_data(buffer) ⇒ Object
36 37 38 |
# File 'lib/erlang/etf/binary.rb', line 36 def serialize_data(buffer) buffer << data.to_utf8_binary end |