Class: BinaryParser::BuiltInTemplate::Binary
Instance Method Summary
collapse
Def, #[], #binary_bit_length, #convert_into_abstract_binary, def_structure, def_var_method, #hold_enough_binary?, #hold_just_binary?, #initialize, #load, #names, #show, structure, #structure_bit_length, #to_chars, #to_i, #to_s
Instance Method Details
#==(other) ⇒ Object
14
15
16
17
18
19
20
21
22
|
# File 'lib/built_in_template/binary.rb', line 14
def ==(other)
if other.is_a?(Binary)
self.to_s == other.to_s
elsif other.is_a?(String)
self.to_s == other
else
super
end
end
|
#content_description ⇒ Object
4
5
6
7
8
|
# File 'lib/built_in_template/binary.rb', line 4
def content_description
chars = to_chars
bytes = chars[0, 5].map{|i| sprintf("0x%02x", i)}.join(", ")
return "[" + bytes + (chars.length > 5 ? ", ..." : "") + "]"
end
|
#to_str ⇒ Object
10
11
12
|
# File 'lib/built_in_template/binary.rb', line 10
def to_str
self.to_s
end
|