Class: ML_ruby::ML_atom
- Inherits:
-
Object
show all
- Defined in:
- lib/ml-ruby/ml_data_types.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(payload) ⇒ ML_atom
Returns a new instance of ML_atom.
21
22
23
|
# File 'lib/ml-ruby/ml_data_types.rb', line 21
def initialize payload
@payload= payload
end
|
Instance Attribute Details
#payload ⇒ Object
Returns the value of attribute payload.
20
21
22
|
# File 'lib/ml-ruby/ml_data_types.rb', line 20
def payload
@payload
end
|
Class Method Details
.decode(data) ⇒ Object
36
37
38
|
# File 'lib/ml-ruby/ml_data_types.rb', line 36
def self.decode data
self.new( data.unpack( self.packstring )[0] )
end
|
.packstring ⇒ Object
30
31
32
|
# File 'lib/ml-ruby/ml_data_types.rb', line 30
def self.packstring
@packstring
end
|
.size ⇒ Object
27
28
29
|
# File 'lib/ml-ruby/ml_data_types.rb', line 27
def self.size
@size
end
|
Instance Method Details
#==(other) ⇒ Object
42
43
44
45
|
# File 'lib/ml-ruby/ml_data_types.rb', line 42
def == other
false if not other
@payload== other.payload
end
|
#encode ⇒ Object
33
34
35
|
# File 'lib/ml-ruby/ml_data_types.rb', line 33
def encode
[ @payload ].pack self.class.packstring
end
|
#inspect ⇒ Object
39
40
41
|
# File 'lib/ml-ruby/ml_data_types.rb', line 39
def inspect
"#{self.class.name}: #{@payload}"
end
|
#size ⇒ Object
24
25
26
|
# File 'lib/ml-ruby/ml_data_types.rb', line 24
def size
self.class.size
end
|